public static void SendUDPData(IPEndPoint _clientEndPoint, ServerPacket _packet) { try { if (_clientEndPoint != null) { udpListener.BeginSend(_packet.ToArray(), _packet.Length(), _clientEndPoint, null, null); } } catch (Exception _ex) { Console.WriteLine($"Error sending data to {_clientEndPoint} via UDP: {_ex}"); } }
public void SendData(ServerPacket _packet) { try { if (socket != null) { stream.BeginWrite(_packet.ToArray(), 0, _packet.Length(), null, null); } } catch (Exception _ex) { Console.WriteLine($"Error sending data to player {id} via TCP: {_ex}"); } }