So far, our IP address discussion above assumes that IP addresses are assigned on a static basis, that you get a specific address for each node in your network and things stay that way. Dynamic Host Configuration Protocol (DHCP) is a protocol that lets a network automatically assign an IP address to each node in a network as it is connected to the network. With the growing number of Internet users these days, many IP addresses are assigned dynamically from a pool of allocated address. This lets many corporate networks and online services economize on the number of IP addresses they use by sharing the pool of IP addresses with a large number of users. This is very often the case if you use a dial-up TCP/IP connection. Here your IP address will vary from one login session to the next because it is assigned to you from a pool that is much smaller than the total number of users. DHCP lets a network administrator supervise and distribute IP addresses from a central point and automati- cally sends a new IP address when a computer is plugged into a different place in the network. Understanding IP addressing thoroughly could certainly take up this entire book and that’s not the point of this book. If you need to know more about IP addressing you are encouraged to read some of the material listed in the reference section of the chapter.
We now turn our attention to the inner workings of TCP/IP, mostly because we will need it when we talk about sockets and some of the different protocols later on in the book. TCP/IP is named after the most commonly used protocols in the Internet Protocol set:
• TCP = Transmission Control Protocol
• IP = Internet Protocol
Designing Embedded Internet Devices
TCP/IP is the basic communication language or protocol of the Internet. It can also be used as a communications protocol in a private network (either an intranet or an extranet). TCP/IP is a two-layer protocol. The higher layer, Transmission Control Protocol, manages the assembling of a message or file into smaller packets (see packet) that are transmitted over the Internet and received by a TCP layer that reas- sembles the packets into the original message. The lower layer, Internet Protocol, handles the address part of each packet so that it gets to the right destination. Each gateway computer on the network checks this address to see where to forward the message. Even though some packets from the same message are routed differently than others, they’ll be reassembled at the destination.
Discussions of network communications often center on what is known as a protocol stack. A protocol is the set of rules that computers (or other network devices) in a network use when they communicate. In essence, a protocol is the language the network devices use to talk to each other. A protocol stack is an abstract model that divides the network up into layers, based on functions and communication protocols used in those functions. Each layer in the stack only talks to the layer above or below it, using the protocols defined in those layers. As information is passed down the stack, it is encapsulated. Encapsulation is basically a process of adding a protocol specific header to the information received from the layer above. As information is passed up the stack, the header specific to the current layer is stripped off and the data is sent to the layer above. By adhering to this protocol stack concept, software and hardware can be designed without worrying about the details of what’s going on in all the layers, just the neighboring layers. Things become reusable, transportable, device independent.
The OSI (Open Systems Interconnection) reference model is an ideal protocol stack of sorts. You will see this model in most discussions and textbooks on network protocols. Its purpose is to guide software developers and hardware designers so that their products will consistently work with other products. The reference model defines seven layers of functions that take place at each end of a communication. Although OSI is not always strictly adhered to in terms of keeping related functions together in a well-defined layer, many if not most products involved in telecommuni- cations make an attempt to describe them in relation to the OSI model. The software and hardware that furnishes these seven layers of functions are usually a combination of the computer operating system, applications (such as your Web browser), TCP/IP or alternative transport and network protocols, and the software and hardware that enable you to put a signal on one of the lines attached to your computer. The OSI reference model is shown in Figure 2-8 and each layer is described below.
• The application layer is where common services of the operating system are offered to all applications. This layer is not the application itself, although some applications may perform application layer functions.)
• The presentation layer is usually the part of an operating system that converts incoming and outgoing data from one format to another (for ex- ample, from a text stream into a popup window with the newly arrived text). This is sometimes called the syntax layer. Compression/decompression and encryption/decryption are performed in this layer.
• The session layer initiates, coordinates, synchronizes and terminates conver-sations and exchanges between the applications at each end. It deals with session and connection coordination.
• The transport layer manages the transmission of messages, determining whether all packets have arrived, and checks for errors.
•The network layer handles the routing and forwarding of the data on the network.
•The data-link layer is the layer that provides synchronization for the physi-cal level. It provides data transmission protocol knowledge and management.
•The physical layer conveys the data stream through the network at the electrical and mechanical level.
What is essential about TCP/IP is that it is a layered protocol that loosely follows this OSI Reference model. Each layer adds information onto the previous layers without modifying the contents of the previous layer. TCP/IP is actually (some will argue this point) implemented in four layers as shown in Figure 2-8. At the top of this stack is the application layer. It is so named because it is at this highest level where we run user applications such as web browsers, Telnet, and FTP programs. The communications protocols associated with the application layer are the related HTTP, Telnet and FTP protocols specific to those applications. At the bottom of the stack is hardware, requiring vendor-specific device drivers. In between are the transport, network and link layers. Each is designed to introduce another level of modularity from top to bottom. Our discussion is going to focus on the transport layer. The transport layer uses communication protocols such as TCP (transport control protocol) and UDP (user datagram protocol) to encapsulate data in the various application layer protocols and forward it to the Internet layer for encapsulation into the Internet Protocol. TCP is considered a connection based protocol, because when two entities communicate using TCP, there is guaranteed receipt of the information, or errors are reported. UDP is not a connection-based protocol. Packets of data are sent and there is no acknowledgement of receipt of data.
Figure 2-8: TCP/IP protocols
Part of the application layer has some very useful functions that we will make extensive use of throughout this book: Telnet, HTTP, FTP and SMTP.
• Telnet is the way to access another computer on a network. Telnet is both a user application and an underlying TCP/IP protocol for accessing remote computers.
• Hypertext Transfer Protocol (HTTP) is the set of rules for exchanging multimedia files (text, graphic images, sound, video) on the World Wide Web. A web server delivers files to your web browser using the HTTP protocol.
• Simple Mail Transfer Protocol (SMTP) is a TCP/IP protocol used for sending and receiving e-mail messages.
• File Transfer Protocol (FTP) is the simple protocol for exchanging files between computers on a network.
All of the above listed protocols (Telnet, FTP, HTTP, SMTP) are used in a client/ server relationship.
In the computing sense, a client is a program or computer that is requesting informa-tion (data) or a service from another program or another computer. A web browser is the most commonly recognized client these days. A server is a computer or program (the term can apply to either) that provides information or services to other computer programs on the same computer or to another computer in a network. A web server is a common example. The client/server relationship describes the relationship between two computer programs in which one program, the client, makes a service request from another program, the server, which fulfills the request. There are many, many types of clients and servers, each specializing in receiving and processing or storing and distributing a certain king of information.