Game Development Reference
In-Depth Information
Figure 12.5 TCP header.
As with the IP header, I won't cover every single element of the TCP header.
However, one important concept bears mentioning—the port . Imagine an office
has 50 employees at a particular address. In this scenario, it makes sense to have
a total of 50 mailboxes, one for each employee. The receptionist will get the daily
delivery of mail from the postal service, and then place each employee's mail in
his or her respective mailbox. Without a mailbox, it would be very frustrating for
employees to find their mail because they would just have to go through an unsor-
ted bin of every employee's mail.
The same type of sorting is applied to the port when sending packets over the net-
work. For instance, most web servers accept connections on port 80, which means
data received on any other port can be ignored by the web server. There is a long
list of Internet services and the ports they typically use, though the assignments
are not strictly enforced. That being said, you probably don't want to have your
game use port 80 because a conflict could occur. There are roughly 65,000 ports
to choose from, so although some do have standardized uses, most systems will
have tens of thousands of ports available at any particular point in time. The game
should select a port that it knows is not being used by any other program. Note
that the source and destination port does not have to be the same, so although the
Search WWH ::




Custom Search