-1

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?

Gimun Eom
  • 411
  • 5
  • 17

1 Answers1

1

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)

from56
  • 3,976
  • 2
  • 13
  • 23
  • Then can I assume that TCP and UDP's inner packet error does not exist, and TCP packet loss means disconnection of socket? – Gimun Eom Dec 19 '20 at 11:17
  • Yes, if TCP fails to deliver a packet an exception will be thrown in your code, but not all exceptions disconnect the socket – from56 Dec 19 '20 at 11:36