Kevin Pauli wrote:
Thanks for the response. That address argument seems to be the target
address.
Sorry, the ‘localhost’ bit threw me off.
I need to specify the IP address to use on the machine where
the Ruby interpreter is running. (My machine is multi-homed, with
several IP addresses bound to it). For example, I would expect
something like this java.net.Socket constructor provides:
public Socket(InetAddress address, int port, InetAddress localAddr,
int localPort)
Notice that you can specify the local address and port as well as the
target address and port.
Am I missing something in the Ruby version, or is the capability
simply not available?
I went looking a bit, but couldn’t find anything that does it directly.
I noticed that UDPSocket has a method bind for setting the local
address, but I can’t find anything similar in TCPSocket. The constructor
for TCPSocket in 1.7 seems to take an argument for the local address,
but how to get that to influence the Net::HTTP?
However, from what I can gather, it might be possible to twiddle this
with setsockopt. If this option can be changed after the initial
connection has been made, you could instance_eval on the Net::HTTP to
get the socket, but what options, level etc to call setsockopt with, I
have no idea.
HTH a little more than my last post.
···
–
([ Kent Dahl ]/)_ ~ [ http://www.stud.ntnu.no/~kentda/ ]/~
))_student/(( _d L b_/ NTNU - graduate engineering - 5. year )
( __õ|õ// ) )Industrial economics and technological management(
_/ö____/ (_engineering.discipline=Computer::Technology)