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