コード例 #1
0
 public static void SendUDPData(IPEndPoint _clientEndPoint, Packet _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}");
     }
 }
コード例 #2
0
 public void SendData(GameServer.Packet _packet)
 {
     try
     {
         if (socket != null)
         {
             stream.BeginWrite(_packet.ToArray(), 0, _packet.Length(), null, null);
         }
     }
     catch (Exception _ex)
     {
         Debug.Log($"Error sending data to server via TCP: {_ex}");
     }
 }
コード例 #3
0
 public void SendData(Packet _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}");
     }
 }
コード例 #4
0
ファイル: Client.cs プロジェクト: Audiofizz/AfitzMP
 public void SendData(Packet packet)
 {
     try
     {
         if (socket != null)
         {
             stream.BeginWrite(packet.ToArray(), 0, packet.Length(), null, null);
         }
     }
     catch (Exception ex)
     {
         Debug.Log($"Error sending data to player {id} via TCP: {ex}");
     }
 }
コード例 #5
0
 public static void SendUDPPacket(IPEndPoint clientIPEndPoint, Packet packet)
 {
     try
     {
         if (clientIPEndPoint != null)
         {
             UDPClient.BeginSend(packet.ToArray(), packet.Length(), clientIPEndPoint, null, null);
         }
     }
     catch (Exception exception)
     {
         Console.WriteLine($"Error, sending data to Client from Server: {clientIPEndPoint} via UDP.\nException {exception}");
     }
 }
コード例 #6
0
ファイル: Client.cs プロジェクト: neelesh/dedicated-server
 public void SendData(Packet _packet)
 {
     try
     {
         if (socket == null)
         {
             return;
         }
         stream.BeginWrite(_packet.ToArray(), 0, _packet.Length(), null, null);
     }
     catch (Exception _ex)
     {
         Console.WriteLine($"Error sendings data to client {id} via TCP: {_ex}");
     }
 }
コード例 #7
0
 public void SendPacket(Packet packet)
 {
     try
     {
         if (Socket != null)
         {
             Stream.BeginWrite(packet.ToArray(), 0, packet.Length(), null, null);
         }
     }
     catch (Exception exception)
     {
         Console.WriteLine($"\n\tError, occured when sending TCP data to client {ID}\nError{exception}");
         Server.ClientDictionary[ID].Disconnect();
     }
 }
コード例 #8
0
ファイル: Server.cs プロジェクト: wmqKevin/Multiplayer
 public static void SendUDPData(IPEndPoint _clientEndPoint, Packet _packet)
 {
     try
     {
         if (_clientEndPoint != null)
         {
             udpListener.BeginSend(_packet.ToArray(), _packet.Length(), _clientEndPoint, null, null);
         }
     }
     catch (Exception e)
     {
         Console.WriteLine($"发送UDP data失败:{e}");
         throw;
     }
 }
コード例 #9
0
ファイル: Client.cs プロジェクト: wmqKevin/Multiplayer
 public void SendData(Packet _packet)
 {
     try
     {
         if (socket != null)
         {
             stream.BeginWrite(_packet.ToArray(), 0, _packet.Length(), null, null);
         }
     }
     catch (Exception e)
     {
         Console.WriteLine($"发送数据错误,id:{id},{e}");
         throw;
     }
 }
コード例 #10
0
ファイル: Server.cs プロジェクト: Audiofizz/AfitzMP
 public static void SendUDPData(IPEndPoint _clientEndPoint, Packet packet)
 {
     try
     {
         //Debug.Log($"Sending UDP data to {_clientEndPoint}");
         if (_clientEndPoint != null)
         {
             udpListener.BeginSend(packet.ToArray(), packet.Length(), _clientEndPoint, null, null);
         }
     }
     catch (Exception ex)
     {
         Debug.Log($"Error Sending UDP data to {_clientEndPoint} via UDP: {ex}");
     }
 }
コード例 #11
0
 public void SendData(Packet packet)
 {
     try
     {
         if (Socket != null)
         {
             _stream.BeginWrite(packet.ToArray(), 0, packet.Length(), null, null);
         }
     }
     catch (Exception e)
     {
         Console.WriteLine($"Error Sending Data To Player {_id} via TCP:");
         Console.WriteLine(e);
     }
 }
コード例 #12
0
 public static void SendUDPData(IPEndPoint _clientEndPoint, Packet _packet)
 {
     try
     {
         if (_clientEndPoint != null)
         {
             udpListener.BeginSend(_packet.ToArray(), _packet.Length(), _clientEndPoint, null, null);
         }
     }
     catch (Exception _ex)
     {
         Console.ForegroundColor = ConsoleColor.Red;
         Console.WriteLine($"Erro ao enviar data para {_clientEndPoint} via UDP: {_ex}");
         Console.ForegroundColor = ConsoleColor.White;
     }
 }
コード例 #13
0
 public void SendData(Packet _packet)
 {
     try
     {
         if (socket != null)
         {
             stream.BeginWrite(_packet.ToArray(), 0, _packet.Length(), null, null);
         }
     }
     catch (Exception _ex)
     {
         Console.ForegroundColor = ConsoleColor.Red;
         Console.WriteLine($"Erro ao enviar data para o Player {id} via TCP: {_ex}");
         Console.ForegroundColor = ConsoleColor.White;
     }
 }
コード例 #14
0
 public static void SendUDPData(IPEndPoint _clientEndPoint, Packet _packet)
 {
     try
     {
         if (_clientEndPoint != null)
         {
             udpListener.BeginSend(_packet.ToArray(), _packet.Length(), _clientEndPoint, null, null);
         }
         else
         {
             // int packEnum = _packet.ReadInt(false);
             // Console.WriteLine($"Error: ClientEndPoint was null on attempted UDP send of packet: {(ServerPackets) packEnum}");
         }
     } catch (Exception _ex)
     {
         Console.WriteLine($"Error sending data to {_clientEndPoint} via UDP: {_ex}");
     }
 }
コード例 #15
0
 public void SendData(Packet packet)
 {
     try
     {
         if (socket != null)
         {
             stream.BeginWrite(packet.ToArray(), 0, packet.Length(), null, null);
             sentPackages++;
         }
     }
     catch (Exception e)
     {
         if (e is System.IO.IOException)
         {
             Console.WriteLine("Player with id: " + id + " lost connection.");
         }
         Console.WriteLine($"Error sending Data to Player {id} via TCP: {e}.");
     }
 }
コード例 #16
0
            public void SendPacket(Packet packet)
            {
                try
                {
                    if (Socket == null)
                    {
                        Console.WriteLine("" +
                                          "\n*************************************" +
                                          "\nSocket is null" +
                                          "\n*************************************");
                    }
                    if (Stream == null)
                    {
                        Console.WriteLine("" +
                                          "\n*************************************" +
                                          "\nStream is null" +
                                          "\n*************************************");
                    }
                    if (packet == null)
                    {
                        Console.WriteLine("" +
                                          "\n*************************************" +
                                          "\nPacket is null" +
                                          "\n*************************************");
                    }

                    if (Socket != null)
                    {
                        Stream.BeginWrite(packet.ToArray(), 0, packet.Length(), null, null);
                    }
                }
                catch (Exception exception)
                {
                    Console.WriteLine($"\n\t\tGameServer: {ServerName} error, sending data to MainServerComms: {Port}\nException {exception}");
                }
            }