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); } }
public bool SendObject(Message o) { if (Client.Connected) { Formatter.Serialize(Stream, o); // the serialization process return true; } else { Stream.Close(); Client.Close(); return false; } }
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; } }