Esempio n. 1
0
 private void OnDisconnect(SocketError socketError, PackageSocketError packageSocketError)
 {
     _tcpflag = false;
     _tcp     = null;
     if (OnDisconnected != null)
     {
         OnDisconnected();
     }
 }
Esempio n. 2
0
        public void Auth(string ipstr, int pt, User u)
        {
            _step = 0;
            _index++;   // index increment.
            _ip        = ipstr;
            _port      = pt;
            _user      = u;
            _handshake = true;

            // TODO:
            // 这里可能需要修改下
            _tcp              = new PackageSocket();
            _tcp.OnConnect    = OnConnect;
            _tcp.OnRecvive    = OnRecvive;
            _tcp.OnDisconnect = OnDisconnect;
            _tcp.SetEnabledPing(false);
            _tcp.SetPackageSocketType(PackageSocketType.Header);
            _tcp.Connect(_ip, _port);
        }