Getting a list of host names

I'm writing my first server and client apps using the Indy socket
components.  These apps will be running on LANs.  I would like to automate
the installation and configuration of these apps as much as possible.  For
instance, what is the best way to determine if a port is already in use on
the host machine I'm installing the server app on?  Also, I'd like the
installation/configuration procedure of the client app to supply a list of
available hosts for the user to pick from instead of requiring the host name
to be known and typed in.  Is this possible?  Since the default port may
have to be changed, what is the best way to poll the host and look for the
port my server app is listening on?  I'm new at this, so, please!, any help
or suggestions would be greatly appreciated.

Regards,

Jon T. Camp
Applied Research Associates