Can I make ruby send network traffic over a specific iface?
Posted
by rjorgenson
on Stack Overflow
See other posts from Stack Overflow
or by rjorgenson
Published on 2010-06-13T18:00:34Z
Indexed on
2010/06/13
18:02 UTC
Read the original article
Hit count: 314
ruby
|network-programming
I am writing a script that grabs the external IP address along with some other information about each iface. I can't figure out how to make ruby send traffic over a specific iface(eth0 and wlan0 for example). I am currently using the open-uri library to open http://whatismyip.org and read it into a variable.
def get_external_ip
begin
open("http://whatismyip.org") { |f| return f.read }
rescue
return "none"
end
end
Is there any way to specify this at runtime of the script or from within the script itself(ideally)?
© Stack Overflow or respective owner