Re: [ANet-devel] Coding: What You Can Do
Status: Abandoned
Brought to you by:
benad
|
From: Quentin S. <que...@co...> - 2001-03-06 15:59:34
|
Hi-
There should also be a way to manually set your IP address. Here is some
perl code that can find your outside IP if you are behind a firewall. I
am behind a firewall, but I can set the firewall to route unidentified
packets to my computer, so this is useful.
use LWP::Simple;
sub getIP() {
#www.dyndns.org = 207.127.235.88 as of 7/30/00
#$IPtxt = get("http://207.127.235.88:8245/cgi-bin/check_ip.cgi");
#Now using upsys.be:
#upsys.be = 213.61.13.10 as of 8/29/00
$IPtxt = get("http://ubsys.by/dyndns/check_ip.php3");
$IPtxt =~ /Address: ?([0-9.]*)/;
$ip = $1;
if (wantarray) {
$IPtxt =~ /Hostname: ([^\n]*)/;
$name = $1;
return ($ip, $name);
}
Please beware of line breaks from email.
--Quentin
Benoit Nadeau wrote:
>> afaik, the default ethernet interface on a linux machine is always
>> "eth0". somebody, please correct me, if i'm wrong. the snippet which
>> you'd sent a few days back should do very well for this. the snippet
>> checks for command line args and if there are none, then prints all the
>> interfaces with their IP addresses and if the interface is specified
>> (for eg, "eth0"), then it will print the IP address of only eth0.
>
>
> Actually, the default routing interface can be anything you want.
> For modem users, it is ppp0. I can't assume that the computer is
> connected to the internet through its ethernet card.
> Look at the "route" command to see what I mean.
>
> Most programs never ask you "what is your default routing interface?.
> So, I know that there is a way to do it, and it would make our deamon
> much more user-friendly, instead of "write the interface in the .anet file"...
>
>> i am not sure if i got you on the second task. you mean you need an
>> editor to write to a device? i am not sure what do you mean by "text
>> device"; if it's serial port, then i suppose minicom kind of tool
>> should do fine.
>
>
> No. Just something other than "cout" or "printf". From what I know, when
> you output something, it is to some terminal device, which, in turn, may do
> fun things like colors, highlighting and so on for displaying text on
> screen. It's because, usually, scanf is blocking, and you can't call printf
> until the user press return. So, basically, I'd like to be able to do
> screen output like vim does on the terminal(with color, bold characters...).
>
> - Benad
>
>
>
> _______________________________________________
> ANet-devel mailing list
> ANe...@li...
> http://lists.sourceforge.net/lists/listinfo/anet-devel
>
>
|