예제 #1
0
        /// <summary>
        /// Sends a server handshake, and a ping request packet if NextState is set to 1.
        /// </summary>
        public void DoHandshake()
        {
            var hs = new SbHandshake();

            hs.ProtocolVersion = 5;
            hs.ServerAddress   = _mainMc.ServerIp;
            hs.ServerPort      = (short)_mainMc.ServerPort;
            hs.NextState       = 2;

            if (_mainMc.ServerState == 1)
            {
                hs.NextState = 1;
            }

            hs.Write(WSock);

            if (_mainMc.ServerState == 1)
            {
                var pingRequest = new SbRequest();
                pingRequest.Write(WSock);
            }
            else
            {
                var loginStart = new SbLoginStart();
                loginStart.Name = _mainMc.ClientName;
                loginStart.Write(WSock);
            }

            RaiseSocketDebug(this, "Handshake sent.");
        }
예제 #2
0
        /// <summary>
        /// Sends a server handshake, and a ping request packet if NextState is set to 1.
        /// </summary>
        public void DoHandshake()
        {
            var hs = new SbHandshake();

            hs.ProtocolVersion = 5;
            hs.ServerAddress   = MainMC.ServerIp;
            hs.ServerPort      = (short)MainMC.ServerPort;
            hs.NextState       = 2;

            if (MainMC.ServerState == 1)
            {
                hs.NextState = 1;
            }

            hs.Write(wSock);

            if (MainMC.ServerState == 1)
            {
                var PingRequest = new SbRequest();
                PingRequest.Write(wSock);
            }
            else
            {
                var LoginStart = new SbLoginStart();
                LoginStart.Name = MainMC.ClientName;
                LoginStart.Write(wSock);
            }

            RaiseSocketDebug(this, "Handshake sent.");
        }