[ 
https://issues.apache.org/jira/browse/HTTPCLIENT-656?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12604470#action_12604470
 ] 

Ralf Hauser commented on HTTPCLIENT-656:
----------------------------------------

ortwin, we do know what server we are going for, but in high performance 
environments, a dns may be resolved to multiple ip addresses and we would like 
to know which one we are currently using since even if there is DNS round robin 
or alike, this doesn't mean all physical instances of an identically named 
service behave the same way...

> IP address of the server of a HttpConnection
> --------------------------------------------
>
>                 Key: HTTPCLIENT-656
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-656
>             Project: HttpComponents HttpClient
>          Issue Type: New Feature
>          Components: HttpConn
>            Reporter: Armin Häberling
>             Fix For: 4.0 Alpha 1
>
>
> AFAIK it's not possible to get the IP address of the server of a 
> HttpConnection.
> I propose to add a getServerAddress() method to the HttpConnection class that 
> returns the IP address of the server, if the connection has been opened.
> And either returns null or throws an Exception if the IP address is not 
> available, i.e. the connection is not open.
> Below is a workaround for getting the IP address in current versions.
> -----------------------
> package org.apache.commons.httpclient;
> import java.io.IOException;
> import java.net.InetAddress;
> public class InetAddressFetcher {
>       private HttpConnection hc;
>       public InetAddressFetcher(HttpConnection hc) {
>               this.hc = hc;
>       }
>       public InetAddress getInetAddress() throws IOException {
>               if (!hc.isOpen()) {
>                       hc.open();
>               }
>               return hc.getSocket().getInetAddress();
>       }
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to