public static void HandleHandshakePacketServer(RUdpServer server, Packet packet, ClientInfo client) { client.IsActive = true; server.SendPacket(new HandshakePacket(), client); Console.WriteLine($@"Received connection from '{client.EndPoint}'!"); }
public static void ChatPacketHandler(RUdpServer server, Packet packet, ClientInfo client) { // Console.WriteLine($"Connection from {client.EndPoint}"); var chat = (ChatPacket)packet; Console.WriteLine($"Received chat message from {client.EndPoint}: {chat.Message}"); foreach (ClientInfo c in server.Clients) { // if (!c.EndPoint.Equals(client.EndPoint)) server.SendPacket(chat, c); } }
public static void LoginPacketHandler(RUdpServer server, Packet packet, ClientInfo client) { // Console.WriteLine($"Connection from {client.EndPoint}"); var login = (LoginPacket)packet; Console.WriteLine($"Logged in: {login.Username}"); foreach (ClientInfo c in server.Clients) { // if (!c.EndPoint.Equals(client.EndPoint)) server.SendPacket(login, c); } }