Search code examples
androidsocketscommunicationserial-communicationloss

What is possible error on communication with TCP, UDP, serial?


I'm developing app containing TCP, UDP, serial connections. I heard that there are some errors or losses in communication. However, I don't know exactly what kind of errors should be handled.

What kind of errors are possible for each method?

  1. change of some bits ex) 11001100 -> 11000101

  2. reversed order of some bytes 00000001 00000010 00000011 -> 00000001 00000011 00000010

  3. some ommited bytes 00000001 00000010 00000011 -> 00000001 00000011

  4. some ommited bits ...000000010000001000000011... -> ...00000010000001000000011... (... 1 2 3 ...) -> (... 2 4 (6 or 7) ...)

Is there any more kinds of error? I think 4 is most difficult case to handle, is it possible case?


Solution

  • TCP: You don't have to worry about errors, it has an intrinsic error control.

    UDP: If the data packet is received it will not have errors, the problem is that it is not guaranteed that the packet will reach its destination. Packets may be lost

    SERIAL: Transmission errors can occur and it is highly recommended to add extra bytes to the transmission for error checking, the most used error check system is "cyclic redundancy check" (CRC)