Using events on multithreading socket server
问题 Im making a server for a new game proyect and im using C# (.NET Framework v4.5) for both client and server. Im currently using something like this to manage my players. new Thread(() => { connection.ListenAndSend(); }).Start(); public void ListenAndSend() { while(working) { if(someThingToRead) { //Listening logic here //Here i call my event for dataReceived with the data i just read. } else if (queue.Count > 0) { Send(queue.Dequeue().Data); //Send data from the Queue } } The use of a Queue is