1. Are you ready for the Galaxy S20? Here is everything we know so far!

Explain difference between TCP and UDP implementations of a chat program.

Discussion in 'Computers' started by thornt, Apr 14, 2012.

  1. thornt

    thornt Lurker
    Thread Starter

    hi guys, could you possibly help me to explain and contrast the two different connection implementations (TCP and UDP) for an Android chat program please. The main points that need explaining are:


    1. Download the Forums for Android™ app!


  2. Granite1

    Granite1 Zercron Encrusted Tweezer

    EarlyMon and alostpacket like this.
  3. thornt

    thornt Lurker
    Thread Starter

    @Granite1 thanks for you speedy reply I appreciate it, that is the sort of information that I am looking for I think, thank you.
    EarlyMon and alostpacket like this.
  4. scythefwd

    scythefwd Well-Known Member

    good succint answer there Granite.

    UDP doesn't have any error correction in the protocol. Programs that use it can have error correction, but its not in the protocol. UDP is basically shouting out and you don't care if someone heard you or not.

    TCP has error correction, not needed in programs that use it because of this. TCP is more like a conversation.. You say a, b, and c, in sequence and the other end says the last thing I got in the sequence was b.. so you sart back over with c, d and e, and the other end says he got everything in sequence up to e, then you go f, g, and h.. ad nausium.
    EarlyMon and alostpacket like this.
  5. alostpacket

    alostpacket Over Macho Grande?

    Just to add to the excellent advice already given, I would just say that a chat app probably should just use TCP as it's easier and more reliable.

    The reason to choose UDP is for performance critical situations like streaming audio or multiplayer gaming, where sending the data as fast as possible is essential.
    EarlyMon and 9to5cynic like this.
  6. Rukbat

    Rukbat Extreme Android User

    alostpacket, the consideration is different - in true streaming, if you lose a packet, there's not much you can do about it, so it doesn't pay to use a protocol designed to fill in missing packets. It would be something like shouting at a deaf person. For speed you use TCP, but something like a variable sliding window protocol (or something like like Zmodem, which got data through the most terrible connections with pretty good speed).

Share This Page