// For accept
        private TransportAsyncWorker(ITransport transport, OperationType operation, AsyncCallback callback, object state)
        {
            _transport = transport;
            _operation = operation;

            _callback = callback;
            _result = new TransportAsyncResult(this, state);
        }
Esempio n. 2
0
        // For accept
        private TransportAsyncWorker(ITransport transport, OperationType operation, AsyncCallback callback, object state)
        {
            _transport = transport;
            _operation = operation;

            _callback = callback;
            _result   = new TransportAsyncResult(this, state);
        }
Esempio n. 3
0
        public void EndSend(IAsyncResult result)
        {
            TransportAsyncResult asyncResult = (TransportAsyncResult)result;

            asyncResult.AsyncWaitHandle.WaitOne();
            Exception ex = asyncResult.Worker.Exception;

            if (ex != null)
            {
                throw ex;
            }
        }
Esempio n. 4
0
        public int EndReceive(IAsyncResult result)
        {
            TransportAsyncResult asyncResult = (TransportAsyncResult)result;

            asyncResult.AsyncWaitHandle.WaitOne();
            Exception ex = asyncResult.Worker.Exception;

            if (ex != null)
            {
                throw ex;
            }
            return(asyncResult.Worker.BytesReceived);
        }
Esempio n. 5
0
        public ITransport EndAccept(IAsyncResult result)
        {
            TransportAsyncResult asyncResult = (TransportAsyncResult)result;

            asyncResult.AsyncWaitHandle.WaitOne();
            Exception ex = asyncResult.Worker.Exception;

            if (ex != null)
            {
                throw ex;
            }
            return(asyncResult.Worker.AcceptedConnection);
        }