Win a copy of Machine Learning with R: Expert techniques for predictive modeling this week in the Artificial Intelligence and Machine Learning forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Problem using apache HttpClient 3.1 to sent large requests

 
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
  • 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: 3281
8
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • 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
  • 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: 3281
8
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • 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).
 
Message for you sir! I think it is a tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!