Пример #1
0
 public static void BroadcastMessage(Message msg, List<Joueur> Joueurs, Joueur Ignore)
 {
     foreach (Joueur jc in Joueurs)
     {
         if(Ignore == null || jc.Client.Client.RemoteEndPoint != Ignore.Client.Client.RemoteEndPoint)
             DataSender.SendObject(jc.Client, msg);
     }
 }
Пример #2
0
 public bool SendObject(Message o)
 {
     if (Client.Connected)
     {
         Formatter.Serialize(Stream, o); // the serialization process
         return true;
     }
     else
     {
         Stream.Close();
         Client.Close();
         return false;
     }
 }
Пример #3
0
 public static bool SendObject(TcpClient client, Message o)
 {
     if (client.Connected)
     {
         IFormatter Formatter = new BinaryFormatter();
         NetworkStream Stream = client.GetStream();
         Formatter.Serialize(Stream, o); // the serialization process
         return true;
     }
     else
     {
         client.Close();
         return false;
     }
 }