What are the differences between sockets using UDP and sockets using TCP on the transport layer?
4 replies to this topic
#1
Posted 05 May 2011 - 11:15 AM
|
|
|
#2
Posted 05 May 2011 - 11:46 AM
UDP is stateless and thus provides means of two way acknowledgement - although there is enough on Wikipedia and other resources to provide a more accurate picture:
http://en.wikipedia...._of_UDP_and_TCP
http://en.wikipedia...._of_UDP_and_TCP
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
#3
Posted 21 January 2012 - 07:27 AM
Base from what I know, there is a difference on the quality of message transmission between UDP and TCP.
For UDP, there is no guarantee that the message will be received. TCP is the opposite for that.
On the other hand, UDP is faster in transmitting messages compared to TCP.
I am just an amateur programmer. Anyone in codecall can correct me with my answers here so I can learn also. :) :)
For UDP, there is no guarantee that the message will be received. TCP is the opposite for that.
On the other hand, UDP is faster in transmitting messages compared to TCP.
I am just an amateur programmer. Anyone in codecall can correct me with my answers here so I can learn also. :) :)
#4
Posted 13 May 2012 - 09:26 AM
Basically in UDP you don't know what happened with packets you have sent. Whether they reach the destination successfully or not, the sender could not care. It's the opposite with TCP. Although there is no guarantee that TCP packets will be received successfully, but sender will be notified if sent packets did not reach destination and sender can resend the packets.
UDP indeed faster than TCP, due to less overhead.
-- Edit
Also TCP packets will be received in order they were sent, unlike UDP. In UDP it is possible the first packet sent will be received after the second or the third, for example. This is possible since the packets might have used different routes to reach the destination.
UDP indeed faster than TCP, due to less overhead.
-- Edit
Also TCP packets will be received in order they were sent, unlike UDP. In UDP it is possible the first packet sent will be received after the second or the third, for example. This is possible since the packets might have used different routes to reach the destination.
#5
Posted 26 May 2012 - 04:49 PM
In summary TCP is reliable "100%" of the time (in theory it should automatically replace packets and receive them in order) but slower. It is used for websites, FTP, SSH, etc. UDP is faster but it is not reliable at all, UDP is normally used in games and VOIP. In VOIP packet loss and out of sync packets are barely noticeably. In games and such there is normally a basic reliability check. For example the sender increases a number in the message each time, the receiver can check this and discard any message with a number smaller than one seen before (Say your updating player positions, without this if a laggy packet reached the receiver after the ones sent later than it others the player would jump backwards momentarily, with it the receiver would discard the message and the player would continue as normal).
Please, write clearly with proper structure. Double spacing makes the text feel un-jointed, Capitalizing Every Word Means People Stop Before Every Word Sub-Consciously Which Is A Pain In The Backside, and use code tags! (The right most styling box).
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









