listener.BeginAccept(new AsyncCallback(AcceptCallback),listener);
allDone.WaitOne();
public static void AcceptCallback(IAsyncResult ar)
{
allDone.Set();
Socket listener = (Socket)ar.AsyncState;
Socket handler = listener.EndAccept(ar);
StateObject state = new StateObject();
state.workSocket = handler;
handler.BeginReceive(state.buffer, 0, StateObject.BufferSize, 0,new AsyncCallback(ReadCallback), state);
}
请问一下这个异步的AsyncCallback(AcceptCallback)是在同一线程,还是会自动在新启动一个线程