示例#1
0
        /// <summary>
        /// 替构造函数初始化对象
        /// </summary>
        public virtual void Initiate(int maxReceiveBufferSize, int maxDatagramsize, int id, Socket socket, TDatabaseBase database)
        {
            m_maxDatagramSize = maxDatagramsize;
            m_id = id;

            m_socket          = socket;
            m_loginTime       = DateTime.Now;
            m_lastSessionTime = m_loginTime;
            m_databaseObj     = database;

            m_receiveBuffer = new byte[maxReceiveBufferSize];  // 数据接收缓冲区
            m_datagramQueue = new Queue <byte[]>();

            if (m_socket != null)
            {
                IPEndPoint iep = m_socket.RemoteEndPoint as IPEndPoint;
                if (iep != null)
                {
                    m_ip = iep.Address.ToString();
                }
            }
        }
示例#2
0
        /// <summary>
        /// 替构造函数初始化对象
        /// </summary>
        public virtual void Initiate(int maxReceiveBufferSize, int maxDatagramsize, int id, Socket socket, TDatabaseBase database)
        {
            m_maxDatagramSize = maxDatagramsize;
            m_id = id;

            m_socket = socket;
            m_loginTime = DateTime.Now;
            m_lastSessionTime = m_loginTime;
            m_databaseObj = database;

            m_receiveBuffer = new byte[maxReceiveBufferSize];  // 数据接收缓冲区
            m_datagramQueue = new Queue<byte[]>();

            if (m_socket != null)
            {
                IPEndPoint iep = m_socket.RemoteEndPoint as IPEndPoint;
                if (iep != null)
                {
                    m_ip = iep.Address.ToString();
                }
            }
        }