Re: How to deal with full-duplex communication?



fadics wrote:
I use CAsyncSocket class.
When A receives a packet, it sends a return receipt to B. B does the same.
When A and B send a packet at the same time, they receive the receipt of
previous packet. So they wait the last receipt at the same time. The
communication breaks. How to solve this problem.

Thank you for any answer. A sample is welcome more.

Your protocol logic must be prepared to process whatever it receives. It cannot assume that the next message must be a return receipt. If your return receipts contain a serial number of the message being acknowledged then you can maintain a list of pending receipts. (It is possible you will receive several messages before receiving a receipt.)

--
Scott McPhillips [VC++ MVP]

.