Boost logo

Boost Users :

Subject: Re: [Boost-users] [boost::asio]Question about how to properly make several async requests (reads and writes)
From: Matheus Araújo Aguiar (matheus.pit_at_[hidden])
Date: 2009-09-04 15:05:31


I have defined a sequence of steps defining how to handle several async
reads/writes. I am dealing with byte streams (TCP).
Could you guys take a look and point any mistakes i might have made, please?
Thanks in advance,

*Write
1. Get a message from a queue;
2. Request async write the message;
3. Write completes and callback handler is called;
4. go back to 1;

* Read (More than one async read have been requested)
1. Create buffer and assign it a sequence number;
2. Request async read passing the buffer;
3. Read completes and callback handler is called;
4. Request another async read;
5. Does the buffer number matches the next buffer number to be processed?
6. Numbers don't match, so put the buffer on a wait queue and exit;
7. Numbers match, so process the buffer;
8. Is there a buffer on the wait queue?
9. There's no buffer in queue, then exit;
10. There's a buffer on the queue, go back to 5;

-- 
Matheus Araújo Aguiar
Computer Scientist
matheus.pit_at_[hidden]


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