hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Malte Ried <Malte.R...@gmx.de>
Subject Sending a large entity causes the client to close the connection
Date Thu, 03 Dec 2009 18:06:38 GMT
Hi!

I'm trying to write a simple server application. It must be able to
serve a big entity (about 45kb) to the client, which is a JBoss
Application Server in my case. Sending the entity results in a
connection reset. I'm not sure why this happens. Maybe the client side
input buffer is not big enough, so the client closes the connection.

This is what I use:

HttpResponse response = new BasicHttpResponse(statusLine);

//set the header with response.addHeader(...);

StringEntity entity = new StringEntity(data, encoding);
response.setEntity(entity);

serverConnection.sendResponseHeader(response);
serverConnection.sendResponseEntity(response);

If I use a very simple client app which just opens a socket and prints
all received data to the console, everything looks right. I also sniffed
the communication between the JBoss and another server which serves the
same data as I would like to serve. This data is sent in many small
chunks (<500 bytes). If I shorten the data to that size, everything
works (beside the data which is missing, of course).

I also tried to use chunked transfer coding but since the
ChunkedOutputStream.write does not split the data, nothing changes.

So, the main question is: How do I send a large entity in small chunks?
Or did I miss something else?

Thanks in advance for every help / comment!

Best regards,

Malte

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Mime
View raw message