Get to know my external IP adress from Ruby?

Hi,

I’m sometimes behind a NAT/Firewall and want to get
my external IP adress that people from outside the NAT
can use to connect to me.

How can I get that from (a pure) Ruby (solution)?

Thanks,

Karsten

···


http://fastmail.fm - Email service worth paying for. Try it for free

coma_killen@fastmail.fm wrote in message
news:20020930093428.127DE2FD13@server4.fastmail.fm…

Hi,

I’m sometimes behind a NAT/Firewall and want to get
my external IP adress that people from outside the NAT
can use to connect to me.

How can I get that from (a pure) Ruby (solution)?

That may not at all be trivial. You have an internal network address and a
portnumber for the communication. The NAT router has these data and makes
the translation. But there is no obvious way you can get access to how the
NAT router makes this translation.

I’m no expert on the subject, but I’d say that you know the external IP
while configuring the NAT router and you can then configure the router to
map portnumbers on the public IP address to a specific internal IP address
and port number.

If you are dealing with dynamic IP, don’t.

In Denmark you can rent your own Linux box hosted at the ISP for about $70 a
month. It’s about the same as an ADSL connection with fixed IP, but with
more bandwidth. You can also provide you own hosted hardware but it’s not
significantly cheaper.

Mikkel

I am new to Ruby. Just started to look at it. I did Smalltalk and now
have been using Java and EJB. I wonder what it would be like to use Ruby
for distributed and Web Application programming. Could someone help give
me some light? Looking at Ruby warms my heart since it seems to have a
lot of the old Smalltalk in it.

Thank you.

Potchanat

“Potchanat Samermit” psamermit@jitsoftware.net wrote in message
news:003c01c268d8$ce282fc0$6800a8c0@samermit1…

I am new to Ruby. Just started to look at it. I did Smalltalk and now
have been using Java and EJB. I wonder what it would be like to use Ruby
for distributed and Web Application programming. Could someone help give
me some light? Looking at Ruby warms my heart since it seems to have a
lot of the old Smalltalk in it.

Welcome to Ruby

Phil Thomson (a regular in this group) wrote an article in a recent Dr.Dobbs
journal issue on using Ruby for distributed processing. It’s so
embarrasingly easy in Ruby that no-one really pays attention to it, it’s
just a tool. Since the article was published, someone wrote Ruby Inline for
embedding C in Ruby, compiling C as required - meaning it is very easy to
use Ruby to distribute C source for CPU intensive processing.
Web-programming is a bit mixed. Ruby does not have as much infrastructure as
you may find in Java or dedicated Web langauges - and worse, not many
hosting services support Ruby. That said, the language is well suited for
Web programming. It has decent CGI and, I belive, Fast-CGI support. There is
mod_ruby, and embedded Ruby (eRuby) for Apache. So you can certainly do web.
Yet you frequently see Ruby people using PHP for Web because they are
pragmatic and sometimes find other tools useful too.

Regards
Mikkel

Thank you, Mikkel. I will look into it. I hope someone will make it so
we can do things easier right from Ruby with WebApp.

Please do advise as you see fit. I feel like I want to use Ruby in what
I am working on. If it needs to go PHP, I might just have to go that
route too, while not using Java. Still need to learn. Thanks.

Potchanat

···

-----Original Message-----
From: MikkelFJ [mailto:mikkelfj-anti-spam@bigfoot.com]
Sent: Monday, September 30, 2002 7:19 PM
To: ruby-talk ML
Subject: Re: Ruby, Client/Server and Web Application

“Potchanat Samermit” psamermit@jitsoftware.net wrote in message
news:003c01c268d8$ce282fc0$6800a8c0@samermit1…

I am new to Ruby. Just started to look at it. I did Smalltalk and now
have been using Java and EJB. I wonder what it would be like to use
Ruby
for distributed and Web Application programming. Could someone help
give
me some light? Looking at Ruby warms my heart since it seems to have a
lot of the old Smalltalk in it.

Welcome to Ruby

Phil Thomson (a regular in this group) wrote an article in a recent
Dr.Dobbs
journal issue on using Ruby for distributed processing. It’s so
embarrasingly easy in Ruby that no-one really pays attention to it, it’s
just a tool. Since the article was published, someone wrote Ruby Inline
for
embedding C in Ruby, compiling C as required - meaning it is very easy
to
use Ruby to distribute C source for CPU intensive processing.
Web-programming is a bit mixed. Ruby does not have as much
infrastructure as
you may find in Java or dedicated Web langauges - and worse, not many
hosting services support Ruby. That said, the language is well suited
for
Web programming. It has decent CGI and, I belive, Fast-CGI support.
There is
mod_ruby, and embedded Ruby (eRuby) for Apache. So you can certainly do
web.
Yet you frequently see Ruby people using PHP for Web because they are
pragmatic and sometimes find other tools useful too.

Regards
Mikkel

It has decent CGI

Not much use for much more than trivial scripts. It’s quite easy to push
execution time past half a second because of startup costs.

pperl can be useful in reducing startup costs for Perl scripts; anyone
want to look into producing pruby? :slight_smile:

And did I mention I’m not keen on cgi’s API? :slight_smile:

and, I belive, Fast-CGI support. There is mod_ruby,

mod_ruby needs to support more servers. Apache 2, IIS, thttpd, even
CGI. It kinda sucks having one API for CGI, one for mod_ruby, another
for FastCGI… blegh.

and embedded Ruby (eRuby) for Apache.

Isn’t eRuby a generalised embedded ruby preprocessor? What’s so
Apacheised about it?

So you can certainly do web.

Don’t forget application servers. They look rather interesting :slight_smile:

Yet you frequently see Ruby people using PHP for Web because they are
pragmatic and sometimes find other tools useful too.

Yes. It’s just so damn easy to get hold of. Not having a minimum startup
cost of 0.1s is nice too :slight_smile:

The language is awful, though… eww.

···


Thomas ‘Freaky’ Hurst - freaky@aagh.net - http://www.aagh.net/

Work is the curse of the drinking classes.
– Mike Romanoff