/// <summary>Sends data to the client via UDP.</summary> /// <param name="_packet">The packet to send.</param> public void SendData(Packet _packet) { try { _packet.InsertGuid(Get.myId); // Insert the client's ID at the start of the packet if (socket != null) { socket.BeginSend(_packet.ToArray(), _packet.Length(), null, null); } } catch (Exception _ex) { Console.WriteLine($"Error sending data to server via UDP: {_ex}"); } }