/// <summary> /// Description forthcoming /// </summary> /// <param name="iar"></param> private void socket_DidAccept(IAsyncResult iar) { lock (lockObj) { if ((flags & kClosed) > 0) return; try { Socket socket = (Socket)iar.AsyncState; Socket newSocket = socket.EndAccept(iar); AsyncSocket newAsyncSocket = new AsyncSocket(); newAsyncSocket.InheritInvokeOptions(this); newAsyncSocket.PreConfigure(newSocket); OnSocketDidAccept(newAsyncSocket); newAsyncSocket.PostConfigure(); // And listen for more connections socket.BeginAccept(new AsyncCallback(socket_DidAccept), socket); } catch (Exception e) { CloseWithException(e); } } }