Professional Documents
Culture Documents
PRASHANTH V GALAGALI
PES UNIVERSITY
Types of Data Deliveries
(Host to host)
(Process to process)
TRANSPORT
LAYER
TCP UDP
UDP - User Datagram Protocol
Used mainly for one way, short communications
datagrams don’t contain information about other packets
Each packet independent of each other
Messages can be no larger than the max UDP packet size
TCP/IP (Transmission Control
Protocol/Internet Protocol)
BUT
Despite the up-front ease of use, a good TCP solution isn’t easy to code.
If so, then why not UDP….????
single socket for communication – unlike TCP which require a socket for each
connected client.
However, for most situations you actually need some concept of a connection,
some rudimentary ordering and often also reliability.
DID U KNOW….!!!!
OOPS…..SORRY ITS
“why does World of Warcraft work despite the occasional 1000+ms delay?”.
Because that is the reality of TCP – on dropped packets you’ll get huge lags as
TCP first needs to detect the missing packet, then resend the packet all while
cutting down throughput.
This property is achieved because the IP protocol is written on top of the TCP
protocol.
TCP/IP PROTOCOL
DOES UDP ALSO SUPPORT THIS FEATURE…????
Reliable UDP will also have a delay.
but since it’s a property of whatever protocol you write on top of UDP, it’s possible
to reduce delays in many ways .
So why does World of Warcraft (and other
games) work with these delays?
It’s simply because they’re able to hide the latency.
In the case of World of Warcraft, there are no player-to-player collisions.
Such collisions can’t be handled reliably predicted – but player-to-environment
can, so the latter works fine with TCP.
Command_a(exp1)
Command_b(exp1,exp2)
Command_a(target)
Command_b(target,fire)
What actually happens with command..???
When the command_a is executing then already the “target” packet would
have arrived.
When the comman_b is executed then, only the “fire” packet would have
been arrived.
Thus in this way TCP protocol controls the traffic congestion.
Does TCP not fail at all…!!!
Player vs player(multi-player) action games often fall into this category.
Everything went fine with LAN internet connection, but problem occurs with the WiFi.
Writing a few test programs showed the WiFi occasionally dropping packets, and every time
that happened, server response time shot up from 100-150 ms to 1000-2000 ms.
Then when to use UDP….???
We replaced the TCP code with a custom reliable UDP implementation which
cut the penalty of a lost packet down to an additional 50 ms(!) – less than the
time of a complete roundtrip.
And that was only possible due having complete control of the reliability layer
on top of UDP.
So UDP or TCP?