Skip to content

Instantly share code, notes, and snippets.

@jmcguirk
Created June 3, 2016 16:15
Show Gist options
  • Save jmcguirk/2c52c301a1762106220905ace5e5ce6c to your computer and use it in GitHub Desktop.
Save jmcguirk/2c52c301a1762106220905ace5e5ce6c to your computer and use it in GitHub Desktop.
public void Run(){
ThreadPool.QueueUserWorkItem((o) =>
{
while (true)
{
TcpClient client = server.AcceptTcpClient();
ThreadPool.QueueUserWorkItem((c) =>
{
try{
ProcessNewClient(client);
} catch(Exception exc){
ServiceLocator.Log.Error("Caught exception processing client " + exc.ToString());
client.Close();
}
});
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment