in reply to How to get client machine IP address

What is the server serving? Someone else assumed it was a web server, but I don't see that in your request. This does matter. If you can hack up the source for the server, then the easiest command is  getpeername(). If not, you'll have to go through some secondary thing like scanning log files or running  netstat.

- doug