Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

3 Questions about UPD

Discussion in 'Multiplayer' started by Rasly233, Mar 20, 2016.

  1. Rasly233

    Rasly233

    Joined:
    Feb 19, 2015
    Posts:
    264
    1. Why UPD packets gets loast?
    2. How many of 100 packets that are all send in same second will usualy reach their desteny?
    3. How much faster is UDP compared to TCP? is it 10 times faster or 2 times?

    Thanks for your answers in advance!
     
  2. zanders33

    zanders33

    Joined:
    Apr 22, 2015
    Posts:
    6
    UDP packets can be dropped, arrive out of order, and get duplicated.
    TCP is built on top of UDP and adds lots of logic to try to prevent these problems and give you a reliable connection - it does this by ordering packets as they arrive, retransmitting dropped packets and acknowledging what it's received so far.

    All of this TCP logic requires many more messages and acknowledgements than UDP, therefore UDP is faster ;)

    UDP can be lost because a router only has so much space to remember packets in it's memory - if the links its connected to become overloaded and it's memory gets full it has to drop packets. It can also drop packets if they get lost or run for too many hops around the internet.

    Thats the gist anyway - Wikipedia has lots of info:
    https://en.wikipedia.org/wiki/Transmission_Control_Protocol
    https://en.wikipedia.org/wiki/User_Datagram_Protocol