Is my network stack screwy, or is there something strange about
UDPSockets in ruby when broadcasting to 127.0.0.255?
irb(main):001:0> require 'socket'
=> true
irb(main):002:0> s = UDPSocket.open
=> #<UDPSocket:0xb7d5f9cc>
irb(main):003:0> s.setsockopt(Socket::SOL_SOCKET, Socket::SO_BROADCAST,
true)
=> 0
irb(main):004:0> s.connect '127.0.0.255', 12345
=> 0
irb(main):005:0> s.send "foo", 0
=> 3
irb(main):006:0> s.send "foo", 0
Errno::ECONNREFUSED: Connection refused - send(2)
from (irb):6:in `send'
from (irb):6
irb(main):007:0> s.send "foo", 0
=> 3
irb(main):008:0> s.send "foo", 0
Errno::ECONNREFUSED: Connection refused - send(2)
from (irb):8:in `send'
from (irb):8
irb(main):009:0> s.send "foo", 0
=> 3
irb(main):010:0> s.send "foo", 0
Errno::ECONNREFUSED: Connection refused - send(2)
from (irb):10:in `send'
from (irb):10
irb(main):011:0> s.send "foo", 0
=> 3
irb(main):012:0> s.send "foo", 0
Errno::ECONNREFUSED: Connection refused - send(2)
from (irb):12:in `send'
from (irb):12
and it just keeps on alternating, more or less the same as that...
There's no problem when I broadcast on a *real* network, like 192.168.1.255.
···
--
vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407