Exemplo n.º 1
0
        protected virtual void Accepted(SocketAcceptEventArgs e)
        {
            SocketAcceptEventHandler handler = OnAccept;

            if (handler != null)
            {
                handler(this, e);
            }
        }
Exemplo n.º 2
0
        // async Accept
        public void StartAccept(SocketAcceptEventHandler externalCallback = null, object externalCallbackState = null)
        {
            AcceptStateObject state = new AcceptStateObject();

            state.workSocket            = _socket;
            state.externalCallback      = externalCallback;
            state.externalCallbackState = externalCallbackState;
            _socket.BeginAccept(
                new System.AsyncCallback(AcceptCallback), state);
        }