Reply to thread

You are looking to get a translation? Its not that difficult.

[VB]

Private Sub StartServer()

    Dim server As New TcpListener(IPAddress.Any, 1234)

    server.Start()

 

    Dim socket As Socket

 

    Dim chatSession As ChatSession

   

    While True

         blocks until a connection is established

        socket = server.AcceptSocket()

 

         when this fires the socket will be connected and the connection

         will actually be setup on a port other than 1234.  this allows

         us to keep servicing future requests on port 1234.

       

         for long running processes, the key is to somehow pass the socket

         off to another thread.  if you dont do this the server will

         not be able to establish new connections while the process is still

         running.

 

        chatSession = New ChatSession(socket)

        chatSessions.Add(chatSession)

    End While

End Sub

[/VB]


There is a sticky thread to help with C#->VB translation.


Back
Top