public void Accept(TcpSocketAcceptCallback callback) { TcpSocketAcceptRoutine routine = new TcpSocketAcceptRoutine(handle, worker); TcpSocketAcceptResult result = new TcpSocketAcceptResult { Handle = handle, Socket = this, OnAccepted = callback }; routine.Execute(result); }
public Task <TcpSocketAccept> Accept() { TcpSocketAcceptRoutine routine = new TcpSocketAcceptRoutine(handle, worker); TcpSocketAcceptResult result = new TcpSocketAcceptResult { Handle = handle, Socket = this, Event = new ManualResetEvent(false), }; Task <TcpSocketAccept> task = Task.Factory.FromAsync(result, result.Unpack); routine.Execute(result); return(task); }