Some material adapted from Computer Networking: A Top-Down Approach Featuring the Internet 3rd edition, copyright 2005 J.F Kurose and K.W. Ross, All Rights Reserved.
The Internet is made up of edge components, core components, and communication media:
- Network edge - The network edge consists of applications running on host computers. Hosts run programs such as email clients, web browsers, email servers, and web servers. The most popular model for communication on the Internet is the client-server model. Clients request and receive services from servers that are always on. In the peer-to-peer (P2P) model, hosts communicate as equals. A host can typically operate as both a client and a server.
- Network core - The network core consists of a series of routers that receive messages from sending hosts or other routers and pass them along until they arrive at the receiving host.
- Communication media - Hosts and routers connect via communication links. Links may be wired or wireless.
Internet Service Models
Programs send messages over the Internet by using sockets
. A socket is an input or output stream that allows an application to send or receive messages. Communication via sockets can be reliable, using the Transport Control Protocol (TCP
), or unreliable, using the User Datagram Protocol (UDP
). Programs such as email and web browsing use TCP. Programs such as streaming media, that are time sensitve but can tolerate loss, use UDP.
The Life of a Packet
A message sent by an application is often referred to as a packet
. From the programmer's perspective, sending a packet involves the following steps:
- Prepare the packet.
- Connect to the receiver by using the receiver's Internet Protocol (IP) address to open a socket.
- Retrieve the output stream created by the socket.
- Push the packet into the output stream.
From the computer's perspective, there are many more steps involved. If reliable communication is desired, the networking stack must keep track of which packets have been sent and which have been received. It must also determine the best route a packet should take through the Internet. Finally, it must determine how to contact the next router along the path to the receiver.
The Internet protocol stack is comprised of 5 layers. These layers decompose the complex functionality of the Internet into manageable pieces.
- Application - The application layer composes messages to be sent to a receiver.
- Transport - The transport layer ensures that communication is reliable and also ensures that each host not take up more than its fair share of the bandwidth.
- Network - The network layer determines how packets should be routed.
- Data Link (or MAC) - The data link layer addresses how neighboring hosts and routers communicate.
- Physical - The physical layer addresses how bits are sent on the wire.
Protocols and SMTP
Networked entities communicate using a series of protocols
. A protocol defines the format and order of messages used for communication. The HyperText Transfer Protocol (HTTP
) defines the messages exchanged between a web browser and a web server. To retrieve a web page, you can telnet directly to a server and type GET /<path to page>
. The server will respond with the page, or with a 404 Not Found message. Following is an example that retrieves my web page:
There are three main components of the electronic mail system:
- User agents - The user agent is the mail reader program. Examples include Outlook, Mac Mail, and Thunderbird. The agent allows you to compose messages and read messages that are stored on the mail server.
- Mail servers - Your mail server stores your incoming and outgoing messages.
- SMTP - The Simple Mail Transport Protocol is the language your user agent uses to speak to the mail server when sending a message, and it is the language mail servers speak when communicating with one another.
The typical path of an email message is as follows:
- The user composes an email message using the user agent.
- The agent contacts the user's mail serer and places the message in an outgoing message queue.
- The sender's mail server contacts the receiver's mail server and uses SMTP to send the message.
- The receiver's mail server places the message into the receiver's inbox.
- The receiver's user agent uses a protocol such as the Post Office Protocol (POP) or the Internet Mail Access Protocol (IMAP) to retrieve the message from the server.
A user agent works by opening a connection to an SMTP server and sending a series of messages uses the SMTP protocol. You can bypass the user agent and communicate directly with the server if you know how to speak the SMTP protocol. Following is an example session: