44 Networking and Online Games: Understanding and Engineering
Basic Internet Architecture destination host s TCP layer explicitly acknowledges received TCP frames, enabling the transmitting TCP layer to detect when losses have occurred. Lost TCP frames are retransmitted until acknowledged by the destination, ultimately ensuring that the application s data is transferred with a high degree of reliability. TCP uses windowed flow control to regulate how fast it transmits packets through the network. The current window size dictates how many unacknowledged packets may be in transit across the network at any given time. The source grows its window as packets are transmitted successfully, and shrinks its window when packet loss is detected (on the assumption that packets are only lost when the network is briefly overloaded). This regulates the bandwidth consumed by a TCP connection. Flow control and retransmission are handled independently in each direction. Because TCP may keep retransmitting for many seconds when faced with repeated packet loss, the end application can experience unpredictable variations in latency (Figure 4.4). Thus, TCP is generally not suitable as the transport protocol for real-time messaging during game play of highly interactive networked games. 4.1.2.2 User Datagram Protocol (UDP) UDP is a much simpler sibling of TCP, providing a connectionless, unreliable, datagram- oriented transport service for applications that do not require or desire the overhead of TCP s service. UDP imposes no flow control on packet transmission, and no packet loss detection or recovery. It is essentially a multiplexing layer sitting directly on top of IP s best effort service. As such an application using UDP will directly experience the latency, jitter and loss characteristics of the underlying IP network. 4.1.2.3 Multiplexing and Flows Extending the postal service analogy a little further, while the IP address is analogous to a street address both TCP and UDP add the notion of ports additional identification analogous to an apartment number or hotel room number. Each TCP or UDP frame carries two16bit port numbers to identify the source and destination of their frame within the context of a particular source or destination IP host. This allows multiplexing of different traffic streams between different applications residing on the same source and destination IP endpoints. IP Network TCP layer Applications TCP layer ApplicationsApplication data flow Losses here cause delays here Figure 4.4 TCP converts IP layer packet loss into application layer delays
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Clan Web Hosting services