private void ReplyChallenge(EndPoint clientEp) { var msg = new BufferWrite(); // get a free challenge number var challengeNr = GetChallengeNr(clientEp); msg.WriteBytes(NetProtocol.ConnectionlessHeader); msg.WriteChar((char)EConnectionType.ServerChallenge); msg.WriteInt(challengeNr); msg.WriteInt(1); // auth protocol msg.WriteString("EE00"); Networking.SendPacket(null, Socket, clientEp, msg.GetData()); }
private void SendConnectPacket(int challengeNr, int authProtocol) { var serverEp = (EndPoint) new IPEndPoint(IPAddress.Any, 0); if (!Networking.StringToAddr(_retryAddress, ref serverEp)) { Console.WriteLine("Bad server address ({0})!\n", serverEp); Disconnect(); return; } var msg = new BufferWrite(); msg.WriteBytes(NetProtocol.ConnectionlessHeader); msg.WriteChar((char)EConnectionType.PlayerConnect); msg.WriteInt(Program.ProtocolVersion); msg.WriteInt(authProtocol); msg.WriteInt(challengeNr); msg.WriteString(Program.ClientName); msg.WriteString(Program.ServerPassword); Networking.SendPacket(null, _socket, serverEp, msg.GetData()); }