public async Task <TcpRemote> ListenAsync(IReceiveCallbackMgr callbackMgr)
        {
            var remoteSocket = await Accept();

            var remote = new TcpRemote(remoteSocket);

            remote.ReceiveCallbackMgr = callbackMgr;
            remote.ReceiveStart();
            return(remote);
        }
示例#2
0
        /// <summary>
        /// 创建TCPRemote并ReceiveStart.在ReceiveStart调用之前设置pipline,以免设置不及时漏掉消息.
        /// </summary>
        /// <param name="pipline"></param>
        /// <returns></returns>
        public async Task <TcpRemote> ListenAsync(ReceiveCallback receiveHandle, IMessagePipeline pipline)
        {
            var remoteSocket = await Accept();

            var remote = new TcpRemote(remoteSocket);

            remote.MessagePipeline    = pipline;
            remote.OnReceiveCallback += receiveHandle;
            remote.ReceiveStart();
            return(remote);
        }