I want to create teamviewer like application in C#. Which protocol is better TCP or UDP in terms of performance?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With