public CNetProcessor()
 {
     this.m_oNetwork       = null;
     this.m_oObserver      = null;
     this.m_oSendStream    = new CByteStream();
     this.m_oRecvStream    = new CByteStream();
     this.m_procDataBuffer = new byte[10240];
     this.r = new System.Random(DateTime.Now.Millisecond);
 }
Beispiel #2
0
 public bool Init(uint dwSendBuffSize, uint dwRecvBuffSize, CNetwork oNetwork, IPacketBreaker oBreaker)
 {
     this.m_nState                    = SocketState.State_Closed;
     this.m_oSocket                   = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
     this.m_oSendBuff                 = new byte[dwSendBuffSize];
     this.m_oRecvBuff                 = new byte[dwRecvBuffSize];
     this.m_nStartPos                 = 0;
     this.m_nEndPos                   = 0;
     this.m_nCurrRecvLen              = 0;
     this.m_bSending                  = false;
     this.m_oNetwork                  = oNetwork;
     this.m_oSocket.SendBufferSize    = (int)dwSendBuffSize;
     this.m_oSocket.ReceiveBufferSize = (int)dwRecvBuffSize;
     this.m_oBreaker                  = oBreaker;
     return(true);
 }