Exemplo n.º 1
0
        public void Accept(TcpSocketAcceptCallback callback)
        {
            TcpSocketAcceptRoutine routine = new TcpSocketAcceptRoutine(handle, worker);
            TcpSocketAcceptResult  result  = new TcpSocketAcceptResult
            {
                Handle     = handle,
                Socket     = this,
                OnAccepted = callback
            };

            routine.Execute(result);
        }
Exemplo n.º 2
0
        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);
        }