Odi, Wolfgang,
In fact Socket#setSendBufferSize/Socket#getSendBufferSize are available since 1.2. So, 
we can use these methods, and we do use them. The problem is that SO_SNDBUF value can 
be changed directly on an HttpConnection instance, and currently there's no way to get 
hold of the active HTTP connection instance through HttpClient. 

In HttpClient 2.1, with new preference architecture in place, there will be an easy 
way to customize HttpConnection parameters. (I recently submitted the patch that 
HttpParams-enables HttpConnection & HttpConnectionManager classes)

Oleg


-----Original Message-----
From: Ortwin Gl�ck [mailto:[EMAIL PROTECTED]
Sent: Thursday, October 16, 2003 08:16
To: Commons HttpClient Project
Subject: Re: socket.setSendBufferSize(int) support?


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: 
> [EMAIL PROTECTED]
> For additional commands, e-mail: 
> [EMAIL PROTECTED]

-- 
  _________________________________________________________________
  NOSE applied intelligence ag

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


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


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

Reply via email to