|
Boost Users : |
Subject: [Boost-users] Boost::Asio -- Is this safe?
From: Dan Eaton (daniel.eaton_at_[hidden])
Date: 2009-10-15 16:59:51
I have a situation where I have two (or more) nodes that need to periodically exchange data in a symmetric fashion - i.e. one needs to send the other a buffer, and vice versa.
Currently I implement this as two async operations:
for(neighboring nodes)
{
async_write(...)
async_read(...)
}
m_ioService.run()
There exists a tcp socket connection between each of the neighbors. The handlers associated with both read and write merely do error checking.
Is this okay, or is there a issue with this approach? In general, it seems to be working fine, but someone brought a bug to my attention whereby they were getting "Transport endpoint not connected." errors happening (under a heavily loaded network, if that makes any difference, but I'm not using any timeouts).
Thanks!
Dan Eaton
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