Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Nov 2006

    how to calculate the byte tranfer to the http server


    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):

    HttpConnection connection = (HttpConnection)Connector.open(request);
    InputStream is = connection.openInputStream();
    long length = connection.getLength();
    byte[] datach = new byte[1];
    int ch = 0;
    while(is.read(datach) != -1)
    	ch = datach[0];
    String s = b.toString();
    The size of each data I have to send or receive is less than 50 bytes.
    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?

  2. #2
    Super Contributor
    Join Date
    Dec 2005

    Re: how to calculate the byte tranfer to the http server


    not sure if that is possible using only client api (though tools like widset support that but I guess due to using SocketConnection not HttpConnection),
    so you could simply provide server-side session bean that counts data-transfer for each user and query that bean from game (that is request that data from server page for each user while ending game session or provide "see my data transfer" online tool for users),


Similar Threads

  1. 6630 S60: Browser is unable to connect to local http server
    By schulze.holger in forum Mobile Java Networking & Messaging & Security
    Replies: 0
    Last Post: 2006-05-24, 06:37
  2. Replies: 1
    Last Post: 2006-02-18, 02:12
  3. ping server or http server
    By bullzi in forum Symbian
    Replies: 1
    Last Post: 2004-12-28, 15:16
  4. http error to connect to Activ server
    By supriya_nandi in forum WAP Servers
    Replies: 2
    Last Post: 2002-11-06, 09:32
  5. Loading images from byte array on 6130i
    By enlightment in forum Mobile Java General
    Replies: 2
    Last Post: 2002-06-05, 19:44

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts