Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Choosing Network protocol TCP or UDP for remote desktop application?

I want to create teamviewer like application in C#. Which protocol is better TCP or UDP in terms of performance?

like image 548
Rajdip Patel Avatar asked Feb 16 '23 14:02

Rajdip Patel


1 Answers

UDP simply sends network messages without enforcing the order, e.g. they can come in out of order, and without checking that the messages got through.

TCP enforces packet ordering, and has a method of checking is messages actually got through. So it is more reliable.

In terms of throughput - e.g. amount of data transferred in a given time - they will in practice be about the same.

The advantage of UDP is lower latency. Because it doesn't check for ordering or confirm receipt of packets - your program receives the packets as they arrive. No waiting confirmations.

You want to use UDP when low latency is critical and the messages are small, and your program is tolerant to missing packets and out of order packets. I've only ever seen it used in video games ( like shooters ) for sending user input.

"teamviewer" to me implies video - large amounts of data - so use TCP.

like image 94
Rafael Baptista Avatar answered Apr 08 '23 06:04

Rafael Baptista