You can either use a UDP broadcast which is the most efficient for a large number of clients:
//Broadcast a shutdown state object to all local network clients
ShutdownState state = new ShutdownState();
NetworkCommsDotNet.Connections.UDP.UDPConnection.SendObject("ClientShutdown", state, new IPEndPoint(IPAddress.Broadcast, 10000));
or using TCP:
List<IPAddress> clientAddresses = new List<IPAddress>() { /* All IPs go here */ };
ShutdownState state = new ShutdownState();
//Connect to each client and send the shutdown packet
foreach (IPAddress address in clientAddresses)
{
try
{
ConnectionInfo clientInfo = new ConnectionInfo(new IPEndPoint(address, 10000));
NetworkCommsDotNet.Connections.TCP.TCPConnection.GetConnection(clientInfo).SendObject("ClientShutdown", state);
}
catch (CommsException)
{
Console.WriteLine("Failed to send shutdown to {0}", address.ToString());
}
}
Regards,
Marc