I have very little experience with threading, and I have googled this for hours without figuring this out.
I followed this tutorial: http://www.switchonthecode.com/tutorials/csharp-tutorial-simple-threaded-tcp-server
Wh开发者_运维问答at is the best way to pass an object from the threads that handle client communication to the main thread. I just want to pass simple data such as who is connected and who sent what message.
Thanks in advance
Well you can use simple synchronization, but that would cause contention in the connection threads, so you can use a queue or similar.
For example :http://en.wikipedia.org/wiki/Producer-consumer_problem
You have an example in C# here : http://www.yoda.arachsys.com/csharp/threads/deadlocks.shtml
精彩评论