Re: Bandwidth usage

2012-08-08 Thread Oleg Kalnichevski
On Wed, 2012-08-08 at 10:26 -0400, Ryan Smith wrote: > Right. you also need to calculate what you send to the web server. So you > need to calculate the request headers when you make a request. Then on the > response you get response body size and header size. As far as I know > thats all you ne

Re: Bandwidth usage

2012-08-08 Thread Luca Colantonio
Hi Jean Marc, I believe Sam is right, counting the bytes is the only way I can see in order to do what you are trying to achieve. It's a bit annoying the way to do that: you need to create a socket factory (that wraps normal sockets with your bytes-counting ones) and register that socket factory

Re: Bandwidth usage

2012-08-08 Thread Sam Crawford
Jean-Marc, What are you comparing it to in order to determine accuracy? If you're looking at the "on-the-wire" size (e.g. through a packet capture, router/switch/interface counters, etc), then that will be counting Ethernet, IP, TCP and potentially other headers too. The size of such headers is no

Re: Bandwidth usage

2012-08-08 Thread Ryan Smith
Right. you also need to calculate what you send to the web server. So you need to calculate the request headers when you make a request. Then on the response you get response body size and header size. As far as I know thats all you need to account for. Maybe Oleg or someone else can verify. O

Re: Bandwidth usage

2012-08-08 Thread Jean-Marc Spaggiari
Hi Ryan, This will calculate the header size. But is there anything else? Is the size only headers + URL lenght for the request, and headers+respons body for the respons? Is there any other CRC, validation, packet, etc.? Because headersize + body lenght seems to not be accurate :( 2012/8/8, Ryan

Re: Bandwidth usage

2012-08-08 Thread Ryan Smith
If HttpClient has a method to do this, can someone let me know? This is a method I wrote to calculate header size: public static int getHeaderByteSize(Header[] headers) { int requestHeaderByteSize = 0; for (Header requestHeader : headers) { if (requestHeader.getName() != null) { requestHeaderByte

Bandwidth usage

2012-08-08 Thread Jean-Marc Spaggiari
Hi, Is there a good way to calculate the bandwidth used by a request? I'm doing a get and I try to track the upload and download bandwidth used. So for a get, there is some upload to the server. There is the URL, and the headers. But seems there is a bit more than that and I'm not able to figure