44 Networking and Online Games: Understanding and Engineering
46 Networking and Online Games: Understanding and Engineering Multiplayer Internet Games 012 3 012 345678 901234 56789 0123456 78901 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+ -+-+-+-+-+ |Version| IHL |Type of Service| Total Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+ -+-+-+-+-+ | Identifi cation |Flags| Fragment Offset | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+ -+-+-+-+-+ | Time to Live | Protocol | Header Chec ksum | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+ -+-+-+-+-+ IPv4 | Source Address | header +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+ -+-+-+-+-+ | Destination Address | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+ -+-+-+-+-+ | Options | Padding | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+ -+-+-+-+-+ TCP/UDP | Source Port Destination Port | ports +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+ -+-+-+-+-+ Figure 4.5 Header fields of interest in IPv4 packets IP address and port number combinations are often written in the form ip-address:port , with a : separating the address (either in dotted-quad or fully qualified domain name form) and the numerical port number. Figure 4.5 shows the key fields of an IPv4 header and the first 32 bits of the TCP or UDP transport header. The protocol field specifies whether the IP packet carries TCP (protocol 6), UDP (protocol 17), or some other type of frame (discussed further in Directory of General Assigned Numbers [IANAP]). The source and destination addresses identify a packet s source and destination host at the IP level. Taken together, port numbers and IP addresses uniquely identify the source and destination applications that are generating and consuming the traffic. A sequence of packets exchanged between the same TCP or UDP ports on the same two endpoints is often referred to as an application flow (or just flow ). Many applications use well-known port numbers, often making it possible to infer the identity of an application from the source or destination port numbers. For example, the Simple Mail Transport Protocol (SMTP) typically uses TCP to port 25 on the mail server host [RFC2821], Quake III Arena servers default to using UDP port 27960, Half-Life 2 servers default to using UDP port 27015 and web servers typically respond to Hypertext Transport Protocol (HTTP) traffic on TCP port 80 [RFC2616]. Note that there are no rules preventing applications from using unconventional ports we could, for example, just as easily run Quake III Arena on port 27015 and Half-Life 2 on port 27960, so long as everyone knows what is happening. 4.1.3 Unicast, Broadcast and Multicast Sending a packet to a single destination is known as unicast transmission. Sending a packet to all destinations (within some specified region of the network) is known as broadcast transmission. Broadcasting may be implemented as multiple separate unicast transmissions, but this requires the source to actually know the IP addresses of all intended destinations. Usually the network supports broadcast natively the source sends a single
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Clan Web Hosting services