Hello!) There is a program like client-server, but it can act as a client and as a server) Ie There is a group of computers connected to the network via Wifi, each one has this program. On one of the computers in the program, a tick is placed that I am a server, which means everyone else must search for it and join it - the clients. Then, after a certain time, the server starts sending messages on its own request, as well as at the request of customers. How to find a server?

Otherwise, knowing in advance the name of the server computer, you can connect to it, but how to know its IP on the network automatically?

Yes, you can of course find out ip through ipconfig, specify it in the client and connect) But how to do it automatically?

Thank.

    1 answer 1

    In the local segment of an Ethernet network, this is done by sending a bradcast udp packet (all to a given port) to which the server responds specifically to the sender (after receiving this packet, we learn the server's IP).

    For a non-local subnet, this method only works if "external" broadcast is enabled on the routers (usually admins close it).

    Will bradcast udp not work in WiFi (but try searching in this direction).