I'm currenctly building a port listener and analytic reporter. The user can specify a port to listen to, and the program will analyse traffic through the port in question. By default, the standard is 3100 and when I attempt to change it, my application crashes and I am presented with this error:
Only one usage of each socket address (protocol/network address/port) is normally permitted (typically under load)
I have investigated and it appears that the sockets are being opened and closed too fast. When I break down into the main problem, this sub is what comes up flagged/highlighted:
Sub Listen() listener = New TcpListener(IPAddress.Any, port) listener.Start() While (True) Dim c As New Connection(listener.AcceptTcpClient()) AddHandler c.GotInfo, AddressOf GotInfo AddHandler c.Disconnected, AddressOf Disconnected End While End Sub
Listener has been Dim'd as TcpListener. Is there any piece of code that can solve this? I've not had any luck so far and I've been digging around for the last hour.
Thanks in advance!