I am working on my first Client server program.

The client will have to connect to the server however there is no way to know what the server ip will be so this needs to happen dinamically, at least the first time the program runs.

The clients will receive strings from the server and send strings to the server.

If you don't know the server IP then there is no way that the client can connect, unless the client has a fixed IP and the server makes the first connection.

What I have done in the past when doing something like this is get the server to ping itself every thirty minutes or so, and then email the IP to myself, if it changes. You could try and apply the same principal if the client has a fixed IP, instead of emailing it you would update the client software.

Edited 3 Years Ago by Octet

Is there really no way for the server to broadcast it's ip over the network?
I've seen programs that did this(not delphi coded) and would like to do something like it.

Maybe i'm expecting to much from delphi.

Is there really no way for the server to broadcast it's ip over the network?

Hold on, are we talking about over a LAN or a WAN? I may of mis-understood your original question but I thought you where talking about trying to get the IP over the internet.

If it is over a LAN, then it probably would be easier to give it a static IP, instead of allowing it to be assigned via DHCP.

It will be a LAN, the computer will probably have a static IP, but as the programmer I do not know what that IP will be

I used your suggested method and it worked well. thank you

This question has already been answered. Start a new discussion instead.