detecting server's ip address by the client
Is it possible to detect the ip address of the server you are connecting?
for example, using winsock, if the server created and started to listen at port "8080" and the ip address is for example "192.168.10.2"
if i'm the client, I can connect by setting the local port to 8080 by default, but the ip is not always the same, so for example the ip address of the server that i'm connecting to, is "192.168.10.2", so what if the i'm going to connect to ip address "192.168.10.3", is there anyway I can detect whose IP addresses created? even if we're not yet connected?
Re: detecting server's ip address by the client
Not as far as I know, unless you want to make the server broadcast a message every now and then to all machines on the network... which is probably not a great idea.
Re: detecting server's ip address by the client
When the client needs to know the IP address of the server, have it broadcast a "where are you?" UDP message to which the server would reply (without broadcasting!) with its IP.
Thats one solution.
Re: detecting server's ip address by the client
Ah yeah I didnt think of doing it the other way around :)