Game Development Reference
In-Depth Information
Figure 12.2 ICMP echo request packet.
The checksum in the ICMP packet is used to make sure there wasn't any packet
corruption in transmission, and is calculated from the values in the ICMP header
andpayloaddata.IfarecipientgetsanICMPpacketwithamismatchedchecksum,
the packet gets rejected. Because the checksum is based on all the other data in
the packet, it must be computed once the packet is ready to transmit. The iden-
tifier and sequence values are specific to echo requests—the identifier is usually
unique per the machine, and the sequence value should be increased every time a
new echo request is sent.
TCP
Transmission Control Protocol (TCP)isoneoftwomethodsagamemightuseto
transmit data over the network. TCP is a connection-based protocol that provides
for guaranteed delivery of all packets in the order they were sent. Guaranteed de-
livery may sound great initially, but as we'll discuss, TCP is typically not as pop-
ular for games as the alternative protocol, UDP.
TCP is connection based, which means that before any data can be transmitted
between two computers, they must first connect to each other. The way this con-
nectionisenforcedisviaahandshakingprocess.Thecomputerrequestingthecon-
nection sends a request to the target computer, telling it specifically how it wants
to connect, and then the receiver confirms the request. This confirmation is further
confirmed by the initial requester, completing the three step handshake process.
Once a TCP connection has been established, it is possible to send data between
the two computers. As mentioned, all packets sent via TCP are guaranteed. The
way this works is when a packet is sent via TCP, the receiver sends an acknow-
Search WWH ::




Custom Search