Re: How to deal with full-duplex communication?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



fadics wrote:
Thank you.

The return receipt I use is the size of all received data. So I can know
which message has been received. But the problem is still there. When both
side send and receive data at same time, the return receipts can not be
sent. Because they don't know whether the last message has been received.

That sounds like a design problem with your code or protocol. It seems to be based on incorrect assumptions about the order of events.


If I send the return receipt immediately regardless of the receiving of other
side, the return receipt may be lost. By the way, I use TCP with
CAsyncSocket. But the lost is still on. I add watch to the OnReceive
function. The return receipt was not received.

This can be caused by code that fails to check the return value of Send. Send can fail and your code must remember this and try again later, when OnSend is called. TCP with CAsyncSocket does not lose data when properly used.

--
Scott McPhillips [VC++ MVP]

.



Relevant Pages

  • Re: Protocols to exchange messages via a socket
    ... protocols are best suitable: ... socket in case of a decoding error? ... You cannot be sure how many messages were lost on the wire behind any ... Since TCP ordinarily provides reliable, ...
    (comp.unix.programmer)
  • Re: Protocols to exchange messages via a socket
    ... socket in case of a decoding error? ... You cannot be sure how many messages were lost on the wire behind any ... Since TCP ordinarily provides reliable, ... no message can ever be 'lost in transit'. ...
    (comp.unix.programmer)
  • Re: Protocols to exchange messages via a socket
    ... socket in case of a decoding error? ... You cannot be sure how many messages were lost on the wire behind any ... Since TCP ordinarily provides reliable, ... the reliability of the CRC16 checksum in TCP? ...
    (comp.unix.programmer)
  • [OT] Re: socket (tcp) buffer status
    ... I write an application that send data using GPRS connection. ... When GSM signal is lost, ... the TCP buffer? ... data from your TCP buffer? ...
    (comp.lang.c)
  • Re: Raid ?
    ... RAID-0 drivers giving you 240MB total. ... one half fails and you're ... my IDE RAID array did fail yesterday - one of the ... all I've lost is a few days of stuff, ...
    (uk.comp.homebuilt)