private void Negotiate(MySqlStream channel) { var body = channel.ReadPacket(); HandshakeInitializationPacket handshakePacket = new HandshakeInitializationPacket(); handshakePacket.FromBytes(body); ConnectionId = handshakePacket.ThreadId; _logger.LogInformation("Handshake initialization packet received, prepare the client authentication packet to send"); ClientAuthenticationPacket clientAuth = new ClientAuthenticationPacket(); clientAuth.CharsetNumber = CharsetNumber; clientAuth.UserName = UserName; clientAuth.Password = Password; clientAuth.DatabaseName = DefaultSchema; clientAuth.ScrumbleBuff = handshakePacket.EncryptionSeed; var clientAuthPkgBody = clientAuth.ToBytes(); channel.SendPacket(clientAuthPkgBody); _logger.LogInformation("Client Authentication Packet is sent out."); channel.ReadPacket(); }
public void Quit() { QuitCommandPacket quit = new QuitCommandPacket(); _channel.SendPacket(quit.ToBytes()); }