From: list-bounce / example.com 
# [mailto:list-bounce / example.com] On Behalf Of Kr Alfabeta
# ...connect method. I need to check connection to server
# www.example.com:xxxx (UDP)
# ...
# The problem is that I don't know what I should print there. 
#
# I just need to check the connection.
# In PHP there are very simple solution:
# $fp = fpsockopen(....)
# if ($fp) return true; else return false;

i think you just want to check a udp connection to a udp server. no problem.

require 'socket'
s = UDPSocket.new
s.connect("10.10.10.10", 10101)
puts "you are connected"  #<-- if you get here, you are connected

the reason the above works is that s.connect will raise an exception if it cannot connect and you'll have to catch the reason by rescue-ing it.

# and just then you can send and receive data.
# Maybe there are any solutions within sockets?

socket programming in ruby is very complete and ranges from low level basic socket programming to high level uri... you might want to read the ruby programming language book..

kind regards -botp