• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

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

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.
 
Upvote 0
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.
 
Upvote 0
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).
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones