Jolix Coder wrote:
My question is: how do I know the hostadress of the server when the server could be running on any random PC over the internet.
Simply. You can't. With client/server, the client needs to know how to get to the server -- the server location has to be reachable and can't be random.
If your applications need to find each other, then you have the logic for both sides to go to an agreed upon location to resolve each others' location. It could be at a multicast group and port, which will require that switches route those packets, or it could be at another address and port, which will require some sort of service to resolve the addresses. Even peer to peer environments uses starting locations, to find peers to other peers to eventually, a peer that has what you want.
Henry