hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ortwin Glück <ortwin.glu...@nose.ch>
Subject Re: socket.setSendBufferSize(int) support?
Date Thu, 16 Oct 2003 06:15:56 GMT
Wolfgang,

Those parameters are only available in JDK 1.4. That is the reason we 
can not provide them in the standard code base. You can still extend the 
DefaultProtocolSocketFactory to return a custom configured socket and 
register it with the Protocol class for the http protocol scheme. Code 
like so:

Protocol.registerProtocol("http", new Protocol("http", new 
CustomSocketFactory(), 80));

public class CustomSocketFactory extends DefaultProtocolSocketFactory {

     /**
      * Constructor for DefaultProtocolSocketFactory.
      */
     public CustomSocketFactory () {
         super();
     }

     /**
      * @see #createSocket(java.lang.String,int,java.net.InetAddress,int)
      */
     public Socket createSocket(
         String host,
         int port,
         InetAddress clientHost,
         int clientPort
     ) throws IOException, UnknownHostException {
         Socket s = super.createSocket(host, port, clientHost, clientPort);
         customize(s);
         return s;
     }

     /**
      * @see ProtocolSocketFactory#createSocket(java.lang.String,int)
      */
     public Socket createSocket(String host, int port)
         throws IOException, UnknownHostException {
         Socket s = super.createSocket(host, port);
         customize(s);
         return s;
     }

     private customize(Socket s) {
        s.setSendBufferSize(5000);
        //customize as you like
     }
}

Wolfgang Hoschek wrote:

> Hi,
> 
> As part of a webapp, I'm trying to abuse commons-httpclient as as client 
> to a high-performance static file download service over high bandwidth 
> long latency network links. Here, tuning TCP windows sizes can make a 
> drastic difference.
> 
> Is there any support in httpclient to configure the socket SO_SNDBUF and 
> SO_RCVBUF, to be set via
> http://java.sun.com/j2se/1.4.2/docs/api/java/net/Socket.html#setSendBufferSize(int) 
> 
> 
> For more background on why these things matter, see, for example:
> 
>     http://www-didc.lbl.gov/tcp-wan-perf.pdf
> 
> Wolfgang.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: 
> commons-httpclient-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: 
> commons-httpclient-dev-help@jakarta.apache.org

-- 
  _________________________________________________________________
  NOSE applied intelligence ag

  ortwin glück                      [www]      http://www.nose.ch
  software engineer                 [email] ortwin.glueck@nose.ch
  hardturmstrasse 171               [pgp key]          0x81CF3416
  8005 zurich                       [office]      +41-1-277 57 35
  switzerland                       [fax]         +41-1-277 57 12


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org


Mime
View raw message