HTML and CSS Reference
In-Depth Information
Appendix D. Computer networking primer
The client-server model is the foundation of the web: Your browser is the client, servers sit
out in the internet cloud, and computer networking is how they talk to each other. JavaScript
can only do so much by itself; most web applications are still built around the communic-
ation back to the web server. The fundamentals of computer networking—and terminology
like headers, latency, throughput, and polling—are covered in most undergraduate computer
science programs, but because web development attracts people from a broad range of back-
grounds, this appendix assumes you've not been through a program like that. Here, we'll
introduce you to the following concepts:
• The basics of computer networking
• The overhead of headers
• Two important network performance metrics: latency and throughput
• Polling versus event-driven communications
• Server-side choices for event-driven web applications
• The WebSocket protocol
Along the way, you'll also briefly review the hacks used in HTML4 to avoid the particular
performance trade-offs inherent in the fundamental web protocol, HTTP. For starters, if
you're not sure what real-time web development even means, this appendix will provide
some context.
D.1. The basics of computer networking
Computer networks have both hardware and software components. Physically, they're wires,
fiber optics, or radio waves, but in software they're defined by what's called a protocol. The
physical wires transmit pure bits of data, zeros and ones; it's the protocols that give those
bits wider meaning.
To keep life simple, the software protocols are divided into layers. At the “bottom” of the
stack are things like Ethernet, which is a protocol for pushing bits along wires by dividing
them into packets. Above that sit protocols like the Internet Protocol (IP), which can deal
with routing messages across several Ethernet connections. On top of this are protocols such
as the Transmission Control Protocol (TCP), which deals with keeping track of which mes-
Search WWH ::




Custom Search