コード例 #1
0
        public ClientConnectionSession(SocketAsyncEventArgs recvSendArgs,
                                       int recvBufferSize, int sendBufferSize)
        {
            _recvCarrier = new ReceiveCarrier(recvSendArgs);

            _startBufferOffset = recvSendArgs.Offset;
            _recvSendArgs      = recvSendArgs;
            _recvBufferSize    = recvBufferSize;

            _initSentOffset = _startBufferOffset + recvBufferSize;
            _sendBufferSize = sendBufferSize;


            //this.KeepAlive = true;
            //Attach the SocketAsyncEventArgs object
            //to its event handler. Since this SocketAsyncEventArgs object is
            //used for both receive and send operations, whenever either of those
            //completes, the IO_Completed method will be called.
            recvSendArgs.Completed += ReceiveSendIO_Completed;
        }
コード例 #2
0
 /// <summary>
 /// receive data
 /// </summary>
 /// <param name="recvCarrier"></param>
 /// <returns>return true if finished</returns>
 protected abstract EndReceiveState ProtocolRecvBuffer(ReceiveCarrier recvCarrier);