snowfox
snowfox

Reputation: 2098

When should I consider using TCP or UDP?

I know, though not that well, the difference and pros & cons between these 2 protocols. Well, I'm still unclear about using them, specifically, which protocol I should employ when building applications on top of them? Are there universal principles or commonly-adopted practices? What factors should be taken into account when making the choice. E.g. UDP is always considered in preference to TCP for video streaming service.

Upvotes: 1

Views: 103

Answers (1)

R__raki__
R__raki__

Reputation: 975

TCP- when you send information there will be acknowledgement like your courier service that you received the courier . if there is no acknowledgement then resend.

UDP-no acknowledgement. no resend.

First you should know sensitivity of information you are sending and receiving . for example if you are dealing with some money transfer you certainly need the acknowledgement that bank received your money, if there is problem in connection you come to know that the packet are lost and you should retransfer your money. (use TCP)

second when in real time communication like VOIP and video streaming if the packets are lost there is no sense in retransmitting them because the time has passed . for example you are speaking with someone over voip and you receive "hello" lost packet in between your communication you feel annoyed and same applies to video streaming.

I hope this helps.

Upvotes: 1

Related Questions