Threading TCPListener

rmatthew

Centurion
Joined
Dec 30, 2002
Messages
115
Location
Texas
I have a simple app that listens on a socket and can handle one connection at time. From what I have read the TCPListener is thread safe but the .Listen may not be....

In any case I want to scale the app to handle 4 or 5 (or more) connections. Any examples or ideas on threading TCPListener?
 
The calls to listen block for both the TCP and UDP client.

I managed to get round the problem by putting the the code to listen inside a loop which I then called from a thread.

That way the app continued to run even if there was no data to recieve. When the app needed to be closed, I just closed the client before aborting the thread.

I hope this makes sense.

Regards

BusterG
 
Back
Top