I'm developing a multiplayer game on mobile phone.
At the end of the connexion, I need to know how many bytes were sent and received from the http server.
Here is the part code for the connexion to the server (the code is functional):
The size of each data I have to send or receive is less than 50 bytes.
HttpConnection connection = (HttpConnection)Connector.open(request);
InputStream is = connection.openInputStream();
long length = connection.getLength();
byte datach = new byte;
int ch = 0;
while(is.read(datach) != -1)
ch = datach;
String s = b.toString();
All I do for now is adding the request size and the server response size.
For each request, I have to count the header size and the data size. But I don't know how to find the header size of my request.
And for each response from the server, I count the header size and the data size with connection.getLength().
I don't know whether it's the right method.
Does anyone know a better method to calculate exactly the bytes sent and received?