From:                   doubleHelix <[EMAIL PROTECTED]>
> ok i know how i can find my INERNAL ip address in a script with perl:
> 
> use Socket;
> print inet_ntoa(inet_aton("")) ."\n";
> 
> but how would I find my EXTERNAL ip address?

Define external ... it's not as simple as it may sound. One 
definition could be "the address that my HTTP requests seem to come 
from". In that case:

1) Find an external web page that displays the IP address
2) send a request to that page using LWP::Simple
3) parse the result

the problem is that it might be the address of a transparent HTTP 
proxy that sits between you and the outside web.

You might try something similar using FTP ... I think some FTP 
servers do include the IP address of the other party in the greeting.


You may want to know the IP address so that you can give it to 
someone so that he can try to connect to your computer from the 
outside ... this may and may not be possible. The firewall may assign 
external IP addresses dynamicaly as you open an outbound connection, 
it may use the same IP address for many computers, it may disallow 
inbound connections completely or allow them only to selected few 
computers&ports etc.

If you need something like this you will probably end up having to 
contact your network admins.

Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to