Hi,
I was messing about the .Net socket code yesterday, hoping to make some use of it, (simple chat program, you know the sort) I tried to run the program which worked fine, but the listener doesn't open a port so doesn't listen...
maybe I am missing something, but either way its not working
Any ideas?
a snippet from the MS Socket samples (which can be found on their website).
Thanks
Daniel.
I was messing about the .Net socket code yesterday, hoping to make some use of it, (simple chat program, you know the sort) I tried to run the program which worked fine, but the listener doesn't open a port so doesn't listen...
maybe I am missing something, but either way its not working
Any ideas?
a snippet from the MS Socket samples (which can be found on their website).
Code:
Private Sub DoListen()
Try
Dim port As Integer = "5000"
mobjListener = New TcpListener(port)
mobjListener.Start()
Do
'Dim x As New Client(mobjListener.AcceptSocket)
Dim x As New Client(mobjListener.AcceptTcpClient)
AddHandler x.Connected, AddressOf OnConnected
AddHandler x.Disconnected, AddressOf OnDisconnected
'AddHandler x.CharsReceived, AddressOf OnCharsReceived
AddHandler x.LineReceived, AddressOf OnLineReceived
mcolClients.Add(x.ID, x)
Dim params() As Object = {"New connection"}
Me.Invoke(New StatusInvoker(AddressOf Me.UpdateStatus), params)
Loop Until False
Catch
End Try
End Sub
Thanks
Daniel.