Lock threads in TCP server

carlos_rocha

Newcomer
Joined
Nov 29, 2004
Messages
4
Hi! i've done a TCP server and i use lock and syncroot to synchronize my threads.The thing is that i've read in the internet that this strategy isn't really thread-safe, all it does is "Monitor.Enter //code Monitor.(something i don't remember)", meaning that it really doesn't lock anything.Is this right, or is it safe to use lock and syncroot? Thanks in advance.
 
When you lock a function, you only allow one thread to use that function at a time, meaning another thread could be idle waiting for that function. You only need one child thread for a TCP/IP server, the thread to listen for incoming connections. Where are you running into problems?
 
Back
Top