• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Problem using apache HttpClient 3.1 to sent large requests

 
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm playing around with HttpClient for the first time and I am able to get it to send small requests but around 3500 bytes I start to get errors and if I use a 4000 byte request it never works. If I attempt to send the same large request through internet explorer it works fine. I used Wireshark to see what the difference was between what IE sent and what HttpClient sent. What I see is that after ie sends the first [ACK] to the server it then sends a [PSH, ACK] to the server that contains the http header info. When I use HttpClient it sends the first [ACK] and then starts sending [ACK]s with the request information. I never see HTTPClient send the HTTP header info. Am I not setting my http header up correctly through HttpClient? Here is my relevant code:



I've tried a lot of different permutations of this but I keep getting this error on larger requests:

Software caused connection abort: socket write error

Am I using the apache code incorrectly? Are there different settings I need to use for large requests? Any guidance would be appreciated.

Thanks
Tom
 
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Tom,

Any reason why you're not using the latest (4+) version?
 
Tom Rispoli
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Martijn, the primary reason I went with 3.1 was that I was able to find the api pages online for it. Since I wasn't sure if there were available api docs for version 4 I went with 3.1.

Actually, I think I fixed my problem this morning. My mistake was that I was trying to send my request parameters by just sending them as part of the URI. I looked at the http client code and saw that when I do that, it tries to send the entire 40k request before it sends the http headers. I guess IE and fiddler must parse out the actual address part of a request and send it first, but httpclient 3.1 assumes that you won't send the parameters as part of the URI. So when I set the parameters using m_postMethod.addParameter things worked much better.

Thanks for the response
Tom
 
Martijn Verburg
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Tom,

Glad you solved it, yes the 4.x docs are some what hidden away (it's because the project is split into core and client).
 
I can't take it! You are too smart for me! Here is the tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic