Exemplo n.º 1
0
 /// <summary>
 /// 这个是服务器收到有效链接初始化
 /// </summary>
 /// <param name="socket"></param>
 internal NettyClient(Socket socket)
 {
     this.ID      = SzExtensions.GetId();
     isServer     = true;
     this._Socket = socket;
     this.SetSocket();
 }
Exemplo n.º 2
0
            public SendTask()
                : base(300)/*间隔300毫秒一直执行的定时器任务*/
            {
                BufferWriter bw = new BufferWriter();

                bw.Write(SzExtensions.GetId());/*发送同步消息唯一id*/
                msg = bw.GetBuffer();
                tmp = new List <IOSession>(NettyPool.Sessions.Values);
            }
Exemplo n.º 3
0
 /// <summary>
 /// 客户端主动请求服务器
 /// </summary>
 /// <param name="ip"></param>
 /// <param name="port"></param>
 public NettyClient(string ip = "127.0.0.1", int port = 9527)
 {
     if (NettyPool.ClientSessionHandler == null)
     {
         throw new Exception("NettyPool.SessionHandler 尚未初始化");
     }
     this.IP   = ip;
     this.Port = port;
     this.ID   = SzExtensions.GetId();
 }