http://www.perlmonks.org?node_id=511355


in reply to server 'autodiscovery' on a LAN

I'm a bit confused by your description. Are you saying the machine on which the script is running is or isn't "it's server"?

If the script runs on "some machine" out on the internet, needs to connect to the central server to get a configuration for this script instance.

Solution: the server should have a fixed name, and a simple DNS lookup will allow you to connect to the correct machine, even if you have to subsequently move it to a different IP. The very act of connecting to the server will tell the server what the client's IP is.

If the machine on which the client runs is "unconfigured" (doesn't even have an IP yet), you're much better off running DHCP client (or bootp client) or some other program which is specificaly written for getting and configuring an IP number than you'd be writing one on your own.