commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard Becke" <rich...@disputable.org>
Subject Re: [HttpClient] Binding to a particular interface/IP?
Date Tue, 13 May 2003 11:55:51 GMT
In that case, I just found this while browsing the CVS. Looks like
the feature you are looking for just got implemented.


HostConfiguration.java, Revision 1.11

Added support for setting HttpConnection local address.
PR: 19827
Submitted by: Laura Werner

     /**
+     * Set the local address to be used when creating connections.
+     * If this is unset, the default address will be used.
+     * This is useful for specifying the interface to use on multi-homed
or clustered systems.
+     *
+     * @param localAddress the local address to use
+     */
+    public synchronized void setLocalAddress(InetAddress localAddress) {
+        this.localAddress = localAddress;
+    }

-- 
/* ®ß */

<quote who="Erik Erskine">
> Richard,
>
>  > This is, I think, not possible. A client does not "bind" to an IP or
> interface. The IP routing subsystem of the OS makes that decision
> based upon target IP address and the routing tables.
>
> This is not a routing issue - the two interfaces are on the same
> network.  They are actually the same card using IP aliasing to have two
> addresses.
>
> What I'm looking for is an equivalent of the following method in
> java.net.Socket:
>
> public Socket(InetAddress address,
>                int port,
>                InetAddress localAddr,
>                int localPort)
>
> The remote server will only accept requests from one of the addresses.
>
> Erik
>
> /--------------------------------------------------------------------\ |
>   Erik Erskine                                                     | |
> Sundayta Ltd                                                     |
> \--------------------------------------------------------------------/
>
>
> --------------------------------------------------------------------- To
> unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org For
> additional commands, e-mail: commons-user-help@jakarta.apache.org




Mime
View raw message