Boost logo

Boost Users :

Subject: Re: [Boost-users] Best method for making synchronous call from async handler
From: Nat Goodspeed (nat_at_[hidden])
Date: 2010-08-23 12:02:26

[Disclaimer: I don't know asio and can't answer your question, sorry.
But I want to better understand what you're asking.]

David Daeschler wrote:

> If the data is not available on the local
> disk, the server needs to contact one or more peer servers it knows
> about, send a query to each one via UDP asking if it has the data, and
> then use an existing TCP connection to that server to retrieve the
> asset.

Silly question: if you already have a TCP connection to each other
server of interest, why not send the query over that connection?

One of the key characteristics of UDP is that a packet might be silently
lost. If you find yourself adding packet sequence numbers and retry
logic, you're starting down the path of a bad partial imitation of TCP.
(Been there, done that...)

> This step must be completed before any more processing can be
> done for the current client even though the client may be sending even
> more requests while we process.

Your subject line implies that you're thinking of doing this with
synchronous calls, but your questions about io_service objects imply
that you mean *logically* synchronous calls (you don't reply to the
original request until some number of complete round trips to these
other servers) using asynchronous asio operations. Am I correct that you
intend asynchronous operations?

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at