Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost::Asio -- Is this safe?
From: Dan Eaton (daniel.eaton_at_[hidden])
Date: 2009-10-15 18:43:42


PS. I should have mentioned that each worker maintains a socket *to* and *from* its partner.

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 mailing list
Boost-us...<http://groups.google.com/groups/unlock?_done=/group/boost-list/browse_thread/thread/b2f660881e76b428&msg=e93094ac386efd4d>@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users



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