> ruby -ve "require 'socket'; UDPSocket.open { |s| s.connect('8.8.8.8', 54); p s.addr }"
jruby 9.0.0.0.pre1 (2.2.0p0) 2015-01-20 d537cab Java HotSpot(TM) 64-Bit Server VM 25.40-b25 on 1.8.0_40-b25 +jit [darwin-x86_64]
["AF_INET", 59035, "10.0.0.3", "10.0.0.3"]
When network is NOT available
> ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
ping: sendto: No route to host
ping: sendto: No route to host
Request timeout for icmp_seq 0
^C
--- 8.8.8.8 ping statistics ---
2 packets transmitted, 0 packets received, 100.0% packet loss
MRI
> ruby -ve "require 'socket'; UDPSocket.open { |s| s.connect('8.8.8.8', 54); p s.addr }"
ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-darwin14]
-e:1:in `connect': Network is unreachable - connect(2) for "8.8.8.8" port 54 (Errno::ENETUNREACH) from -e:1:in `block in <main>' from -e:1:in `open' from -e:1:in `<main>'
JRuby
> ruby -ve "require 'socket'; UDPSocket.open { |s| s.connect('8.8.8.8', 54); p s.addr }"
jruby 9.0.0.0.pre1 (2.2.0p0) 2015-01-20 d537cab Java HotSpot(TM) 64-Bit Server VM 25.40-b25 on 1.8.0_40-b25 +jit [darwin-x86_64]
SocketError: connect: name or service not known
connect at org/jruby/ext/socket/RubyUDPSocket.java:190
-e_CLOSURE_1__-e_0 at -e:1
open at org/j
The text was updated successfully, but these errors were encountered:
Ok, looks like we're not using the catch-all exception reprocessing logic (Ruby.newIOErrorFromException) in UDPSocket, TCPSocket, or TCPServer. Fixing.
When network is available:
> ping 8.8.8.8 PING 8.8.8.8 (8.8.8.8): 56 data bytes 64 bytes from 8.8.8.8: icmp_seq=0 ttl=40 time=67.330 ms 64 bytes from 8.8.8.8: icmp_seq=1 ttl=40 time=67.808 ms ^C --- 8.8.8.8 ping statistics --- 2 packets transmitted, 2 packets received, 0.0% packet loss round-trip min/avg/max/stddev = 67.330/67.569/67.808/0.239 ms
MRI:
JRuby:
When network is NOT available
MRI
JRuby
The text was updated successfully, but these errors were encountered: