[mailto:list-bounce / example.com] On Behalf Of Kr Alfabeta
# irb(main):001:0> require 'socket'
# => true
# irb(main):002:0> s = UDPSocket.new
# => #<UDPSocket:0xb7d3c590>
# irb(main):003:0> s.connect('xxx.xx.xx.xx', 2555)
# => 0
# irb(main):004:0> puts 'ok'
# ok
# => nil
#
# I think this example really shows the problem about which I
# am talking :)
mea culpa. you're right. ruby does indeed implems basic udp, nothing more, nothing less. Reading the ruby book, the udp#connect method just saves the target and port for #send. So udp#connect is not really a connect.
if you want a confirmation or a real connect, you need TCPSocket since it does a handshake to connect or implem icmp or handshake-like protocol using udp.
eg,
irb(main):095:0> t=TCPSocket.new "10.2.10.1",80
=> #<TCPSocket:0xb7de652c>
irb(main):096:0> t=TCPSocket.new "10.2.10.11",80
Errno::EHOSTUNREACH: No route to host - connect(2)
Also, see James Tuckers's posts.
kind regards -botp