/// <summary> /// 替构造函数初始化对象 /// </summary> public virtual void Initiate(int maxDatagramsize, int id, Socket socket, TDatabaseBase database, SocketListener SListener /*BufferManager bufferManager*/) { base.ID = id; base.LoginTime = DateTime.Now; // 替换buffermanager [12/12/2011 test] //m_bufferManager = bufferManager; //m_recvBufferOffSet = bufferManager.GetRecvBuffer(); //m_sendBufferOffSet = bufferManager.GetSendBuffer(); // 替换buffermanager [12/12/2011 test] //m_bufferBlockIndex = bufferManager.GetBufferBlockIndex(); //if (m_bufferBlockIndex == -1) // 没有空块, 新建 //{ // m_receiveBuffer = new byte[m_bufferManager.ReceiveBufferSize]; // m_sendBuffer = new byte[m_bufferManager.SendBufferSize]; //} //else //{ // m_receiveBuffer = m_bufferManager.ReceiveBuffer; // m_sendBuffer = m_bufferManager.SendBuffer; //} m_SocketLister = SListener; m_ReceiveSocketArgs = null; m_SendSocketArgs = null; m_bCanSend = true; m_maxDatagramSize = maxDatagramsize; m_socket = socket; m_databaseObj = database; m_datagramQueue = new Queue <byte[]>(); //创建发送消息队列 m_datagramQueue_send = new Queue <byte[]>(); if (m_socket != null) { IPEndPoint iep = m_socket.RemoteEndPoint as IPEndPoint; if (iep != null) { base.IP = iep.Address.ToString(); } } }