Thanks, that helps a lot.
My biggest problem is probably the MS example I chose to build from.
- passing nothing in the state parameter
- I was inside a class called 'client', making it a bit tough to get the
TCPClient.client (socket)

So, I think I've sorted that out with
'class UserConnection, the class that was called "client"
Public Sub New(ByVal Myclient As TcpClient)
Me.clientConn = Myclient
Dim ClientSocket As Socket = Me.Client  'requires Inherits TcpClient
Me.clientConn.GetStream.BeginRead(readBuffer, 0, READ_BUFFER_SIZE, AddressOf
StreamReceiver, ClientSocket)
End Sub

Private Sub StreamReceiver(ByVal ar As IAsyncResult)
Dim ClientSocket As Socket = CType(ar.AsyncState, Socket)

but I still get a "null" exception error here
Dim Clientaddress As String = ClientSocket.RemoteEndPoint.ToString()

which makes sense if the problem is "me", in
Dim ClientSocket As Socket = Me.Client
which should(?) be
Dim ClientSocket As Socket = Myclient.Client
but then I get property client() is not accessible in this context because
it's protected

Can you tell me how to get the socket in this context, or do I need to pick
it up from the TcpListener?

Private Sub DoListen()
listener = New TcpListener(System.Net.IPAddress.Any, PORT_NUM)
listener.Start()
Do
Dim Connection As New UserConnection(listener.AcceptTcpClient)
AddHandler Connection.LineReceived, AddressOf OnLineReceived
Loop Until False

===================================
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