Skip to content

Instantly share code, notes, and snippets.

@jmcguirk
Created June 3, 2016 16:16
Show Gist options
  • Save jmcguirk/e0439f83b82f1d3f015ccec7ae8fb6bc to your computer and use it in GitHub Desktop.
Save jmcguirk/e0439f83b82f1d3f015ccec7ae8fb6bc 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