Boost logo

Boost Users :

Subject: Re: [Boost-users] boost asio disign
From: huvcbo (christer.borgqvist10_at_[hidden])
Date: 2013-01-24 04:42:42


Christer Borgqvist skrev 12/19/2012 03:51 PM:
> Hello,
> how can I design an application that will have a http server like HTTP
> Server 3 example,
> but also x number of tcp clients connecting to a server,
> client must connect to the server before the http server is active, if
> client is idle with a timer events send an 'I'm here' in every 10 seconds,
> i tink i have to put the tcp client on a list or ?.
> Data is received by the http server get the client from list, if non
> available wait for x amount of time, if time elapsed return incomming data,
> else,
> parsing on incomming data,
> send to tcp server, parse response data put the client back on the list,
> send response on http,
> when sending data via tcp client reset the timer.
>
> I have the http server working but how do I do with the tcp client, design
> the threads,
> should there be only one io_service?,
> I dont now, im lost!
>
> Appreciate all the help.
> /Christer
>
Thanks for your reply,
In my HTTP connection SERVER3 :: handle_incomming_data,
I download a tcp / client from a list "client = q.pop_back ();"
client-> Hiso_event.connect (boost :: bind (& connection: Event, this, _1));
clien-> write ("some data")
while I wait for the Event connection object goes out of scope,
've tried async_wait but have not managed to solve the problem
appreciate all the help.
/ Christer


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net