Boost logo

Boost Users :

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


When I do request_stream << message; I'm putting the content of message into
the variable request. The variable request is a private variable that
belongs to the Client class. As I said before, the asynchronous functions
are called first (the constructor calls async_resolve, which calls
async_connect, which calls async_write, which calls async_read). Only then
is the send function called from the main function.

Anyway, I'm trying to do this for UDP as well, and only now I manged to get
it to work. I had to do io_service.reset() before I did io_service.run(). I
guess it should be something like this in the TCP solution.

I'm sorry if I'm not very good at explaining myself, but I'm new using the
boost library as well as new to this forum.

Thanks for your attention,
Henrique Aparício

Igor R wrote:
>
>>
>>
>> This is my function Client::send():
>>
>> void Client::send(const string &message) {
>>
>> ostream request_stream(&request);
>> request_stream << message;
>>
>> io_service.run();
>> }
>>
>> What are you doing with request_stream? I don't see in your send()
>> function
> any call to async_write or so. Besides, running io_service here doesn't
> seem
> to make sense...
> Please, refer to the tutorial to understand the basic usage patterns of
> asio:
> http://www.boost.org/doc/libs/1_37_0/doc/html/boost_asio/tutorial.html
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>

-- 
View this message in context: http://www.nabble.com/-asio--sending-multiple-messages-in-the-same-soocket-tp20833971p20840516.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