I this goes out twice, that's my bad.

Hi Sudha,

Do you mean a remote computer querying the script through a socket?

Is so, after you've accepted the connection (probably in a loop of some kind) with...

$paddr = accept(Client, Server);

... use the following two lines at the top of the loop...

my($port, $iaddr) = sockaddr_in($paddr);
my $name = gethostbyaddr($iaddr,AF_INET);

... or something similar for your network (the 'AF_INET' bit I mean).

gethostbyname wouldn't work because it takes the name as an argument.

If I got it wrong, and you just want the local system address, use the environment variable...




This email message (and any accompanying file attachments) may contain confidential or privileged information and is intended for the sole use of the addressee(s) named above. If you are not the intended recipient, or the person responsible for delivering this message to the intended recipient, please notify Toowoomba City Council immediately and destroy any copies of the original message.
Any unauthorised review, use, alteration, disclosure or distribution of this email (including any attachments) by an unintended recipient is prohibited.
While all care is taken, Council cannot guarantee that this email message (and any accompanying file attachments) are free of viruses.
The Council accepts no responsibility for the content of any email which is sent by an employee which is of a personal nature or which represents the personal view of the sender.