Le 2 fr. 06, 22:48, Dave King a rit :

> I was wondering if there is any way to specify the time-to-live value 
> of
> an IP socket in ruby?
>

This might be platform dependent. On Linux, look at 'man 7 ip' and 
IP_TTL. In Ruby, you would do the same thing, call the #setsockopt 
method on your socket.

In Ruby:

irb(main):001:0> require 'socket'
=> true
irb(main):002:0> s = UDPSocket.new
=> #<UDPSocket:0xb7b86a54>
irb(main):004:0> s.getsockopt(Socket::SOL_IP, Socket::IP_TTL)
=> "@\000\000\000"
irb(main):005:0> s.getsockopt(Socket::SOL_IP, 
Socket::IP_TTL).unpack("L")
=> [64]
irb(main):006:0> s.setsockopt(Socket::SOL_IP, Socket::IP_TTL, 
[128].pack("L"))
=> 0
irb(main):007:0> s.getsockopt(Socket::SOL_IP, 
Socket::IP_TTL).unpack("L")
=> [128]

To check if a given argument to #getsockopt is supported on your 
platform, you can look at the constants defined with Socket.constants.

Hope this help,
Guillaume.