Hey guys,
A while back I posted a message about multithreading in .NET 2.0 to maintain
GUI responsivness while using a TCPListener to monitor a TCP port for
transmission. One of the MVP's in the group (Cor Ligthert) mentioned using
the queue class to do this.
I have, unfortunatly, been unable to date to figure out how to do this. (I
have achieved the project in a console application, where a GUI isnt
utilized, using the same code I show in my example below.) Does anyone have
an example, or other methods, that I can use to achieve a GUI TCPListener
implementation?
My current implementation revolves around this code (condensed):
Dim server As New TcpListener(localAddr, port)
While True 'Constant Monitor
Dim client As TcpClient = server.AcceptTcpClient()
Dim stream As NetworkStream = client.GetStream()
then break the stream down into bytes and read its contents
End While
Obviously the constant While loop is causing an unresponsive GUI, but I dont
see another way to constantly wait for a TCP message without multithreading,
and if thats the way I need to go I hope someone can provide an example for
me.
Again, thanks for the help,
chrisj