Exemple #1
0
        public void StartAccept(SockMgrAcceptEventHandler externalCallback = null, object externalCallbackState = null)
        {
            SockMgrAcceptStateObject state = new SockMgrAcceptStateObject();

            state.externalCallback      = externalCallback;
            state.externalCallbackState = externalCallbackState;
            _sockBase.StartAccept(AcceptCallback, state);
        }
Exemple #2
0
        private void AcceptCallback(object sender, SocketAcceptEventArgs e)
        {
            SockMgrAcceptStateObject state = (SockMgrAcceptStateObject)e.State.externalCallbackState;
            SockMgr client             = new SockMgr(e.Handler, (Protocol.IProtocolFactory)_protocolFactory.Clone());
            SockMgrAcceptEventArgs arg = new SockMgrAcceptEventArgs(client, e.State, state.externalCallbackState);

            SockMgrAcceptEvent?.Invoke(this, arg);
            if (state.externalCallback != null)
            {
                state.externalCallback(this, arg);
            }
            _responser.OnSockMgrAccept(this, arg);
        }