Overview
Features
Download
Documentation
Community
Add-Ons & Services

How to use HTTPClientSession::receiveResponse without blocking?

Please post support and help requests here.

How to use HTTPClientSession::receiveResponse without blocking?

Postby francisr » 12 Dec 2007, 18:41

Hi all,

I have a GUI application that makes a connection with a server. I want to avoid that my GUI freezes when waiting for a response for the server. I had the idea of using istream::readsome in combination with a Timer (read a little on each timer event until complete) but since I am not really familiar with IO coding I suspect there may be superior ways.

I would appreciate to learn your insights on this :)

Kind regards,
Francis
francisr
 
Posts: 21
Joined: 09 Dec 2007, 13:19

Re: How to use HTTPClientSession::receiveResponse without blocking?

Postby alex » 12 Dec 2007, 23:12

> I have a GUI application that makes a connection with a server. I want to avoid that my GUI freezes when waiting for a response for the server. I had the idea of using istream::readsome in combination with a Timer (read a little on each timer event until complete) but since I am not really familiar with IO coding I suspect there may be superior ways.
>
> I would appreciate to learn your insights on this :)

Francis,

I'd put client session in a separate Thread and use NotificationQueue or delegates. To learn how to run HTTP client in a separate thread, look into Net HTTPLoadTest sample. There is Foundation sample for NotificationQueue in Foundation and for delegates, look up Ping sample in Net.

HTH

Alex
alex
 
Posts: 1099
Joined: 11 Jul 2006, 16:27
Location: United_States

Re: Re: How to use HTTPClientSession::receiveResponse without blocking?

Postby francisr » 29 Dec 2007, 04:26

Just a quick question, would Poco::ActiveMethod also be suitable for this? ActiveResult method wait() would make a new thread for executing the code. Would this work?

Regards,

Francis
francisr
 
Posts: 21
Joined: 09 Dec 2007, 13:19

Re: Re: Re: How to use HTTPClientSession::receiveResponse without blocking?

Postby alex » 29 Dec 2007, 21:47

> Just a quick question, would Poco::ActiveMethod also be suitable for this? ActiveResult method wait() would make a new thread for executing the code. Would this work?

It should. ActiveMethod (a.k.a. "future") is nothing but a fancy thread.

Alex
alex
 
Posts: 1099
Joined: 11 Jul 2006, 16:27
Location: United_States


Return to Support

Who is online

Users browsing this forum: No registered users and 2 guests