public void HandleHandshake(HandshakePacket packet) { if (packet.Username != null && !IsLoggingIn) { IsLoggingIn = true; // check for baned users // if (banlist.Contains(client)) { // client.SendPacket(new KickPacket() { message = "You'r BANNED!!!! Get lost!" }; // return; // } Console.WriteLine("Received Login for User " + packet.Username); Console.WriteLine("Send Handshake back!"); SendPacket(new HandshakePacket(packet.Username)); Console.WriteLine("Send Player Information"); LoadPlayer(); SendPlayerInfo(); Console.WriteLine("Send Pattern"); SendPattern(); LastSendKeepAliveStamp = DateTime.Now.Ticks; Console.WriteLine("Finished Init. Send KeepAlive"); KeepAlivePacket keepAlive = new KeepAlivePacket {TimeStamp = LastSendKeepAliveStamp}; SendPacket(keepAlive); } }
public static void ReadHandshake(Client client, PacketReader reader) { HandshakePacket hp = new HandshakePacket(); hp.Read(reader); if (!reader.Failed) { client.HandleHandshake(hp); } }
public static void HandleHandshake(Client client, HandshakePacket hp) { //Handle Handshake Console.WriteLine("Received Handshake Packet back from Server :))"); }
public void Start(IPEndPoint ipEndpoint) { _running = true; try { _socket.Connect(ipEndpoint); } catch (Exception) { Console.WriteLine("Error while connecting to Slaysher Server"); } _socketAsyncArgs.Completed += RecvCompleted; _socketAsyncArgs.SetBuffer(_recvBuffer, 0, 2048); _receiveQueueReader.Start(); Task.Factory.StartNew(RecvPacket); HandshakePacket handshake = new HandshakePacket {Username = _userName}; SendPacket(handshake); }