/// <summary> /// 初始化Network /// </summary> /// <param name="oProc"></param> /// <param name="oBreaker"></param> /// <param name="dwSendBuffSize">发送缓存数组</param> /// <param name="dwRecvBuffSize">接收缓存数组</param> /// <param name="strLogDir">network.log的目录</param> /// <param name="bLogEnabled">是否启动log</param> /// <returns></returns> public bool Init(INetProcess oProc, IPacketBreaker oBreaker, uint dwSendBuffSize, uint dwRecvBuffSize, string strLogDir, bool bLogEnabled) { this.m_oProcess = oProc; this.m_oBreaker = oBreaker; this.m_dwSendBuffSize = dwSendBuffSize; this.m_dwRecvBuffSize = dwRecvBuffSize; this.m_PieceBufferIO = new PieceBufferIO(); this.m_oDataQueue = new Queue(); this.m_oLogger = new CNetLogger(strLogDir, bLogEnabled); this.m_oLogger.LogInfo("-----------------------------"); this.m_oLogger.LogInfo("Init network succ"); return(true); }
public CClientSocket() { this.m_oSocket = null; this.m_nState = SocketState.State_Closed; this.m_oSendBuff = null; this.m_oRecvBuff = null; this.m_nStartPos = 0; this.m_nEndPos = 0; this.m_nCurrRecvLen = 0; this.m_bSending = false; this.m_oSendBuff = null; this.m_oBreaker = null; }
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); }
public abstract bool Init(uint dwSendBuffSize, uint dwRecvBuffSize, IPacketBreaker oBreaker);