Reputation: 31
I´m fairly new to programming, especially networking. I can make basic applications and such but now i´m playing around with networking. Which out of UDP and TCP would be easier to implement and maintain on a basic level for a beginner looking to get a grasp and experiement some?
Upvotes: 0
Views: 282
Reputation: 481
They both use the same general interface for sending data. You'll use some form of send function. The details will depend on the language you're using.
UDP is a little easier to begin experimenting with because each UDP send results in a single packet being sent (not really but logically that's what it represents). This would let you make an experiment like:
Client
Server
It would be pretty straight forward to experiment with multiple clients with the above client and server.
If data integrity is important (order of data is important. Missing data is a problem) then TCP is what you'll want to use. TCP doesn't have the notion of "messages" so if discrete "messages" is something you want then you'll need to build that into the data you're sending
A dropped message here or there is OK? Messages out of order isn't a problem? UDP should work fine.
You'll want to dig into the protocol details to figure out if UDP or TCP fit your application. There are a number of details about TCP and UDP that go well beyond the (extremely) short descriptions I've given above. You'll need to know at least some of them to make a valid decision on which one fits your application.
Upvotes: 2