public static void DoAcceptTcpClientCallback(IAsyncResult ar) { // Get the listener that handles the client request. Socket listener = (Socket)ar.AsyncState; // End the operation and display the received data on // the console. Socket client = listener.EndAccept(ar); // client.NoDelay = true; //client.Client.NoDelay = true; TcpClientObject tcp = TcpHelperUtil.GetPortDetails(client); tcp.Client = client; try { tcp.ThreadIndex = ++m_threadIndex; } catch (Exception ex) { ////TCPClientProcessor.Proxylog.Logger.Error(ex); tcp.ThreadIndex = m_threadIndex = 0; } // Signal the calling thread to continue. m_tcpClientConnected.Set(); try { Task.Factory.StartNew(() => TCPClientProcessor.ProcessTCPClient(tcp)); } catch (Exception ex) { ////TCPClientProcessor.Proxylog.Logger.Error(ex); } }