After "Dim client As Socket = CType(ar.AsyncState, Socket)",
client = nothing, and any attempt to use client throws

"An unhandled exception of type System.NullReferenceException occurred in
...
Object reference not set to an instance of an object'

So, my issue seems to be not that I get an exception, but that
client=Nothing in the first place.

Thanks for any suggestions

----- Original Message -----
From: "Ian Griffiths" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, July 19, 2004 7:44 PM
Subject: Re: [ADVANCED-DOTNET] Client IP Address


What is the exception that you're getting?


--
Ian Griffiths - DevelopMentor
http://www.interact-sw.co.uk/iangblog/

> -----Original Message-----
> From: Peter Suter
>
> Hi All,
> In a sub much like this one, from "Using an Asynchronous Client Socket
> [Visual Basic]", I keep getting an exception rather than a socket.
> Is there a problem getting the socket using this technique?
> (I'm trying to get the Client IP Address)
>
> Private Shared Sub ConnectCallback(ar As IAsyncResult)
>     Try
>         ' Retrieve the socket from the state object.
>         Dim client As Socket = CType(ar.AsyncState, Socket)
>
>         ' Complete the connection.
>         client.EndConnect(ar)
>
>         Console.WriteLine("Socket connected to {0}", _
>             client.RemoteEndPoint.ToString())
>
>         ' Signal that the connection has been made.
>         connectDone.Set()
>     Catch e As Exception
>         Console.WriteLine(e.ToString())
>     End Try
> End Sub 'ConnectCallback

===================================
This list is hosted by DevelopMentor�  http://www.develop.com
Some .NET courses you may be interested in:

NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles
http://www.develop.com/courses/gaspdotnetls

View archives and manage your subscription(s) at http://discuss.develop.com

===================================
This list is hosted by DevelopMentor�  http://www.develop.com
Some .NET courses you may be interested in:

NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles
http://www.develop.com/courses/gaspdotnetls

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to