示例#1
0
 public void SendData(Packet _packet)
 {
     try
     {
         _packet.InsertInt(Client.myId);
         if (socket != null)
         {
             socket.BeginSend(_packet.ToArray(), _packet.Length(), null, null);
         }
     }
     catch (Exception _ex)
     {
         Console.WriteLine($"Error sending data to server via UDP: {_ex}");
     }
 }
示例#2
0
 /// <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}");
     }
 }
示例#3
0
            public void SendData(Packet packet)
            {
                try
                {
                    packet.InsertInt(instance.myId);

                    if (socket != null)
                    {
                        socket.BeginSend(packet.ToArray(), packet.Length(), null, null);
                    }
                }
                catch (Exception e)
                {
                    Debug.LogError($"Error sending data to server via UDP: {e}");
                }
            }
示例#4
0
        /// <summary>Sends data to the server via UDP.</summary>
        /// <param name="_packet">The packet to send.</param>
        public void SendData(Packet packet)
        {
            try
            {
                packet.InsertInt(Client.Instance.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}");
            }
        }