HTTP client

Login to reply to this topic.
Thu, 2004-10-28 09:27
Joined: 2004-10-28
Forum posts: 14
Hello,

 I am a beginner in Symbian C++ developing. I am programming a simple HTTP client using RHTTPSession and RHTTPTransaction classes. In this application it's needed to obtain data transfer rate and several times values. My problem is that I don't know how can I get the total number of bytes of request/response and measure time between request are sent and the response are completely received.
 
 Thanks.

Wed, 2004-11-03 14:47
Forum Nokia Champion
Joined: 2003-10-01
Forum posts: 723
HTTP client
Hi,

First, you will need to study HTTP specification, RFC 2616. For the length of an incoming chunk, you'll need to obtain the value of Content-Length response header. You can do this, if you register your class as an observer for transaction events. Have a look at MHTTPTransactionCallback class for more details. You have to register yourself for various events, like THTTPEvent::EGotResponseHeaders or THTTPEvent::ESubmit. This way, you'll know when you're issuing a request and when the response has arrived.

Cheers,

tOtE

Gabor Torok
Software architect, Agil Eight (http://www.agileight.com/)
Blog: http://mobile-thoughts.blogspot.com/

Thu, 2004-11-04 09:09
Joined: 2004-10-28
Forum posts: 14
HTTP client
Hello again,

I know Content-Length header, but it only contains the bytes of response content, and I need bytes of whole the response (which includes status line, response headers and body) and request in order to obtain bytes/sec of transaction.
I have been watching HTTP example client source code and I also have a MHTTPTransactionCallback class, but it doesn't receive THTTPEvent::ESubmit after it is called Submit() method. Do you how can it be possible?

Thanks a lot.
Thu, 2004-11-04 12:30
Forum Nokia Champion
Joined: 2003-10-01
Forum posts: 723
HTTP client
Hi,

Now I understood what you want to do. Well, there may be a few alternatives:
- first, collect all the parts of the response header and add their sizes ==> the sum will be the size of received bytes (okay, over HTTP).
- I've just discovered a function: RConnection::DataReceivedNotificationRequest. It may also be useful for you. How to get the HTTP session's RConnection?

Code:
RHTTPSession session;
...
THTTPHdrVal connHandle;
session.ConnectionInfo().Property( session.StringPool().StringF( HTTP::EHttpSocketConnection ), connHandle );

// do some error handling if Property method returns EFalse or
// connHandle.Type() != KTIntVal

RConnection connection = REINTERPRET_CAST( RConnection&, connHandle.Int() );

Hope that the code above works, I haven't even tried to compile it!

As to MHFRunL is not called after a request has been submitted - I don't know why it's not get called, it should be!

Cheers,

tOtE

Gabor Torok
Software architect, Agil Eight (http://www.agileight.com/)
Blog: http://mobile-thoughts.blogspot.com/

Thu, 2004-11-04 15:49
Joined: 2004-10-28
Forum posts: 14
HTTP client
I will try to do it using RConnection::DataReceivedNotificationRequest(), it seems to be that I was looking for. I hope it will work fine Wink

Thank you very much, tote.
Wed, 2007-05-16 14:09
Joined: 2006-11-22
Forum posts: 44
Re: HTTP client
Hi,

i want to retrieve Content-Length in THTTPEvent::EGotResponseHeaders. how can i retrieve it.

please help me.
  • Login to reply to this topic.