Ejemplo n.º 1
0
        public static ResultPacket GetResultPacket(PacketData packetData)
        {
            ResultPacket resultPacket = null;
            if (packetData.Data[4] == 0xfe && packetData.BodyLength <= 9)
            {
                resultPacket = new EOFPacket();
            }
            else if (packetData.Data[4] == 0x00)
            {
                resultPacket = new OKPacket();
            }
            else if (packetData.Data[4] == 0xff)
            {
                resultPacket = new ErrorPacket();
            }

            if (resultPacket != null)
            {
                resultPacket.Read(packetData.Data);
            }
            return resultPacket;
        }
Ejemplo n.º 2
0
        private void ReceiveHandShake()
        {
            var request = new HandshakeResponse41Packet();
            ReceivePacket(request);
            MySqlPacket response = null;
            if (VerifyChallenge(request.UserName, request.AuthResponse))
            {
                response = new OKPacket()
              {
                  AffectedRows = 0,
                  LastInsertId = 0,
                  Status = StatusFlags.SERVER_STATUS_AUTOCOMMIT,
                  Capabilities = CapabilityFlags.CLIENT_PROTOCOL_41,
                  Info = string.Empty
              };
            }
            else { }

            SendPacket(response);
        }