Boost logo

Boost Users :

Subject: [Boost-users] [asio] sending multiple messages in the same soocket
From: Henrique Aparício (henrique.aparicio_at_[hidden])
Date: 2008-12-04 09:48:43


Hi!
I'm trying to implement an asynchronous client to communicate with a server
using asio. To do this, I'm following the example of the http client (
http://tenermerx.com/Asio/asio-1.3.1/src/examples/http/client/async_client.cpp
http://tenermerx.com/Asio/asio-1.3.1/src/examples/http/client/async_client.cpp
), but I'm trying to make it so that it can be used for a more general
purpose. So in my implementation I have the same methods that appear in the
example, but with only one method for reading the response.

My main function calls the constructor of the client which is responsible
for initializing variables and calling the chain of asynchronous methods.
After this, the main function calls a method send(message), that puts the
message I want to send in the variable request and runs the io_service.

The problem is that I want to be able to call this send function several
times, but it only works the first time I call it. For example:

Client c(host, port); //remember that the constructor calls the
asynchronous methods
c.send("msg to send");
c.send("msg to send");

The message is actually sent the first time, but the rest of the times
nothing happens. What am I missing? Can you help me? If you need more
information to be able to help, please ask me.

Henrique Aparício

-- 
View this message in context: http://www.nabble.com/-asio--sending-multiple-messages-in-the-same-soocket-tp20833971p20833971.html
Sent from the Boost - Users mailing list archive at Nabble.com.

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