英文:
caculate how many data Apache.HttpClient recevied?
问题
我只想在HTTP上测量服务器-客户端的网络速度。
为此,我的服务器API返回大数据(1GB,字节数组),客户端请求此API,但在特定秒数后会被强制断开连接。
然后我将计算有多少客户端收到数据,并将秒数相除。
我正在使用CloseableHttpAsyncClient
,HttpAsyncRequestProducer
,AsyncCharConsumer<HttpResponse>
。并且我在AsyncCharConsumer<HttpResponse>.onCharReceived()
中汇总接收到的数据,并尝试使用HttpGet.abort()
断开连接。
当我没有强制断开连接时,汇总的数据是正确的,但此请求被中止,汇总值为0
。我该如何解决?谢谢。
英文:
I simply want to measure the network speed server-client on HTTP.
For that, My Server API return the big data(1GB, byte array) and Client request to this API but will disconnect forcingly after specific seconds.
And then I will calculate how many client got and divide seconds.
I am using CloseableHttpAsyncClient
, HttpAsyncRequestProducer
, AsyncCharConsumer<HttpResponse>
. and I summarize received data in AsyncCharConsumer<HttpResponse>.onCharReceived()
and try to disconnect using HttpGet.abort()
.
When I didn't disconnect forcely, summarized mount is correct but this request was aborted, summarized value is 0
. How can I get that? thanks.
专注分享java语言的经验与见解,让所有开发者获益!
评论