示例#1
0
 public SaeaConnectState(ILog log, int id, TimeOut timeOut, SaeaConnectStatePool pool)
 {
     this.log            = log;
     this.id             = id;
     this.timeOut        = timeOut;
     _m_ConnectStatePool = pool;
 }
示例#2
0
        public bool Init()
        {
            try
            {
                //初始化Sokect
                listenSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                //初始化IP地址
                ipAddress  = IPAddress.Parse(ipString);
                ipEndPoint = new IPEndPoint(ipAddress, ipPort);

                //初始化缓存池
                connectStatePool = new SaeaConnectStatePool(log, timeOut);
                connectStatePool.Init(maxConnectNum);

                return(true);
            }
            catch (Exception e)
            {
                string errorInfor = string.Format("Server init error: {0}", e.Message);
                log.ErrorLog(errorInfor);
                return(false);
            }
        }