/// <summary> /// Client is performing a handshake. /// </summary> /// <param name="packet"></param> void OnHandshake(PacketReader packet) { // Generate a random key for the encryption. Key has to be 1 or higher. If the // key is 0 it causes the client to malform certain unicode encoded strings beyond repair. uint key = 2789743391; // (uint)( Server.Random.Next() | 1 ); Connection.SetEncryption(new Encryption(key)); Send(PacketGenerator.Handshake(key, Connection.IP)); }