From: Ted Pon on 2 Jun 2010 16:08 Hi all, I am a student learning ruby and I am getting an error that I can't figure out. It works on my teacher's mac, however does not on my laptop. Windows Vista 64-bit My ruby version is: 1.9.1p378 (2010-01-10 revision 26273) [i386-mingw32] Here is what I've tried in cmd irb irb(main):002:0> require 'socket' => true irb(main):005:0> TCPSocket.open('0.0.0.0', 8888) Errno::EADDRNOTAVAIL: The requested address is not valid in its context. - conne ct(2) from (irb):5:in `initialize' from (irb):5:in `open' from (irb):5 from C:/Ruby19/bin/irb:12:in `<main>' Any help would be appreciated! -- Posted via http://www.ruby-forum.com/.
From: Rob Biedenharn on 2 Jun 2010 16:31 On Jun 2, 2010, at 4:08 PM, Ted Pon wrote: > Hi all, > > I am a student learning ruby and I am getting an error that I can't > figure out. It works on my teacher's mac, however does not on my > laptop. > > Windows Vista 64-bit > My ruby version is: 1.9.1p378 (2010-01-10 revision 26273) [i386- > mingw32] > > > Here is what I've tried in cmd > > irb > > irb(main):002:0> require 'socket' > => true > irb(main):005:0> TCPSocket.open('0.0.0.0', 8888) > Errno::EADDRNOTAVAIL: The requested address is not valid in its > context. > - conne > ct(2) > from (irb):5:in `initialize' > from (irb):5:in `open' > from (irb):5 > from C:/Ruby19/bin/irb:12:in `<main>' > > Any help would be appreciated! > -- > Posted via http://www.ruby-forum.com/. > Is there a server listening at port 8888? server = TCPServer.new('0.0.0.0', 8888) There's some examples in the Programming Ruby book from the Pragmatic Publishers. -Rob Rob Biedenharn http://agileconsultingllc.com Rob(a)AgileConsultingLLC.com http://gaslightsoftware.com rab(a)GaslightSoftware.com
From: Brian Candler on 2 Jun 2010 16:50 Ted Pon wrote: > irb(main):002:0> require 'socket' > => true > irb(main):005:0> TCPSocket.open('0.0.0.0', 8888) > Errno::EADDRNOTAVAIL: The requested address is not valid in its context. Like it says, 0.0.0.0 is not a valid destination IP address. Try instead: TCPSocket.open('127.0.0.1', 8888) -- Posted via http://www.ruby-forum.com/.
From: Caleb Clausen on 2 Jun 2010 19:22 On 6/2/10, Ted Pon <ted_pon(a)hotmail.com> wrote: > Hi all, > > I am a student learning ruby and I am getting an error that I can't > figure out. It works on my teacher's mac, however does not on my laptop. > > Windows Vista 64-bit > My ruby version is: 1.9.1p378 (2010-01-10 revision 26273) [i386-mingw32] > > > Here is what I've tried in cmd > > irb > > irb(main):002:0> require 'socket' > => true > irb(main):005:0> TCPSocket.open('0.0.0.0', 8888) > Errno::EADDRNOTAVAIL: The requested address is not valid in its context. > - conne > ct(2) > from (irb):5:in `initialize' > from (irb):5:in `open' > from (irb):5 > from C:/Ruby19/bin/irb:12:in `<main>' > > Any help would be appreciated! Apparently, 0.0.0.0 is treated as a loopback address on the mac. Apple got this wrong; that's a broadcast address and should be treated as the same as 255.255.255.255. 127.0.0.1 is the canonical loopback address, and that's what you should use for greatest portability.
From: Joel VanderWerf on 2 Jun 2010 22:31 Caleb Clausen wrote: > On 6/2/10, Ted Pon <ted_pon(a)hotmail.com> wrote: >> Hi all, >> >> I am a student learning ruby and I am getting an error that I can't >> figure out. It works on my teacher's mac, however does not on my laptop. >> >> Windows Vista 64-bit >> My ruby version is: 1.9.1p378 (2010-01-10 revision 26273) [i386-mingw32] >> >> >> Here is what I've tried in cmd >> >> irb >> >> irb(main):002:0> require 'socket' >> => true >> irb(main):005:0> TCPSocket.open('0.0.0.0', 8888) >> Errno::EADDRNOTAVAIL: The requested address is not valid in its context. >> - conne >> ct(2) >> from (irb):5:in `initialize' >> from (irb):5:in `open' >> from (irb):5 >> from C:/Ruby19/bin/irb:12:in `<main>' >> >> Any help would be appreciated! > > Apparently, 0.0.0.0 is treated as a loopback address on the mac. Apple > got this wrong; that's a broadcast address and should be treated as > the same as 255.255.255.255. 127.0.0.1 is the canonical loopback > address, and that's what you should use for greatest portability. IIUC 0.0.0.0 is the default route, not a broadcast addr. If you bind a tcp server to 0.0.0.0, then you can accept connections from any interface. I didn't know you could use this on the client side, too.
|
Next
|
Last
Pages: 1 2 3 Prev: webserver status, need better approach Next: ruby-1.9.1-p378 hangs on make ripper.c |