{
TcpListener listener = new TcpListener(IPAddress.Any , 8000);
TcpClient client;
listener.Start();
while (true) // Add your exit flag here
{
client = listener.AcceptTcpClient();
ThreadPool.QueueUserWorkItem(ThreadProc, client);
}
}
private static void ThreadProc(object obj)
{
var client = (TcpClient)obj;
// Do your work here
}
[ 發表回應 ] ( 17預覽 ) | 常註連結 | ( 3 / 1403 )