Lock threads in TCP server

carlos_rocha

New member
Joined
Nov 29, 2004
Messages
4
Hi! ive done a TCP server and i use lock and syncroot to synchronize my threads.The thing is that ive read in the internet that this strategy isnt really thread-safe, all it does is "Monitor.Enter //code Monitor.(something i dont remember)", meaning that it really doesnt 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