>  Well, I don't understand sorry

No, it seems you understand me pretty well :)
 
> pigeon% cat b.rb
[.........snip.............]
> pigeon% 

Woow! Thanks a lot! This code accomplishes exactly the job I need. :)

Anyway, I'm still confused why my version doesn't work :(
I did it this way:

(1/wejn/ns) ~$ cat sock.rb
#!/usr/bin/env ruby
require 'socket'

if ARGV.size != 3
    puts "Usage: #{$0} <local port> <remote port> <msg>"
    exit 0
end

BasicSocket.do_not_reverse_lookup = true

u = UDPSocket.new
u.bind('0.0.0.0', ARGV[0])

t1 = Thread.new {
    loop {
        s = select([u], nil, nil, 0.01)
        next if s.nil? or s[0].size.zero?
        x = u.recvfrom(65535)
        print "Received: "
        p x
        sleep 1
    }
}

t2 = Thread.new {
    loop {
        u.send(ARGV[2], 0, '127.0.0.1', ARGV[1]) rescue \
            puts "SendError: #{$!} -- #{$!.type}"
        puts "Sent: #{ARGV[2]}"
        sleep 1
    }
}

t2.join
t1.join
u.close
# vim: set sw=4 ts=4 ai :
(1/wejn/ns) ~$

W.
-- 
              Wejn <lists+rubytalk(at)box.cz>
(svamberk.net's Linux section, fi.muni.cz student, linuxfan)
>>>         Bored?  Want hours of entertainment?         <<<
>>>           Just set the initdefault to 6!             <<<