예제 #1
0
        protected DynamicBufferManager m_sendBuffer;             //发送数据的缓存,统一写到内存中,调用一次发送

        public SyncSocketInvokeElement()
        {
            m_tcpClient = new TcpClient();
            m_tcpClient.Client.Blocking = true; //使用阻塞模式,即同步模式
            m_protocolFlag          = ProtocolFlag.None;
            SocketTimeOutMS         = ProtocolConst.SocketTimeOutMS;
            m_outgoingDataAssembler = new OutgoingDataAssembler();
            m_recvBuffer            = new DynamicBufferManager(ProtocolConst.ReceiveBufferSize);
            m_incomingDataParser    = new IncomingDataParser();
            m_sendBuffer            = new DynamicBufferManager(ProtocolConst.ReceiveBufferSize);
        }
예제 #2
0
 public AsyncSocketServer()
 {
     tcpClient = new TcpClient();
     tcpClient.Client.Blocking = true; //使用阻塞模式,即同步模式
     protocolFlag          = ProtocolFlag.None;
     SocketTimeOutMS       = ProtocolConst.SocketTimeOutMS;
     outgoingDataAssembler = new OutgoingDataAssembler();
     recvBuffer            = new DynamicBufferManager(ProtocolConst.ReceiveBufferSize);
     incomingDataParser    = new IncomingDataParser();
     sendBuffer            = new DynamicBufferManager(ProtocolConst.ReceiveBufferSize);
 }
예제 #3
0
        public AsyncSocketInvokeElement(AsyncSocketServer asyncSocketServer, AsyncSocketUserToken asyncSocketUserToken)
        {
            this.asyncSocketServer    = asyncSocketServer;
            this.asyncSocketUserToken = asyncSocketUserToken;

            netByteOrder = false;

            incomingDataParser    = new IncomingDataParser();
            outgoingDataAssembler = new OutgoingDataAssembler();

            sendAsync = false;

            connectDT = DateTime.UtcNow;
            activeDT  = DateTime.UtcNow;
        }
예제 #4
0
        public AsyncSocketInvokeElement(AsyncSocketServer asyncSocketServer, AsyncSocketUserToken asyncSocketUserToken)
        {
            m_asyncSocketServer = asyncSocketServer;
            m_asyncSocketUserToken = asyncSocketUserToken;

            m_netByteOrder = true;

            m_incomingDataParser = new IncomingDataParser();
            m_outgoingDataAssembler = new OutgoingDataAssembler();

            m_sendAsync = false;

            m_connectDT = DateTime.UtcNow;
            m_activeDT = DateTime.UtcNow;
        }