Home Forums Support client-server to exchange files (like in p2p?) Reply To: client-server to exchange files (like in p2p?)

#1002
Anonymous
Inactive

Unfortunately it is not possible to provide a fully functional short code sample that would contain the necessary functionality. We provide larger code samples but only to our licensed customers.

My suggestion would be to have any connected devices listening on a given port and then send a short UDP packet from the server to all IP’s within your network. If any device responds you can then establish a TCP connection, e.g on the server:

int listeningPort = 10000;
string localIPRange = "192.168.0";
for (int i = 1; i < 255; i++)
    UDPConnection.SendObject("aliveTest", 0, new IPEndPoint(IPAddress.Parse(localIPRange + "." + i.ToString()), listeningPort));

Regards,
Marc