The fundamental operation in the client-server model is the transaction. A client-server transaction consists of four steps:
1. When a client needs service, it initiates a transaction by sending a request to the server. For example, when a Web browser needs a file, it sends a request to a Web server.
2. The server receives the request, interprets it, and manipulates its resources in the appropriate way. For example, when a Web server receives a request from a browser, it reads a disk file.
3. The server sends a response to the client, and then waits for the next request. For example, a Web server sends the file back to a client.
4. The client receives the response and manipulates it. For example, after a Web browser receives a page from the server, it displays it on the screen.
Physically, a network is a hierarchical system that is organized by geographical proximity. At the lowest level is a LAN (Local Area Network) that spans a building or a campus.
A hub slavishly copies every bit that it receives on each port to every other port. Thus,
every host sees every bit.
An Ethernet segment consists of some wires (usually twisted pairs of wires)
and a small box called a hub. Multiple Ethernet segments can be connected into larger LANs, called bridged Ethernets, using a set of wires and small boxes called bridges. At a higher level in the hierarchy, multiple incompatible LANs can be connected by specialized computers called routers to form an internet (interconnected network).
a layer of protocol software running on each host and router that smoothes out the differences between the different networks. -Naming scheme: defining a uniform format for host addresses -Delivery mechanism: defining a uniform way to bundle up data bits into discrete chunks called packets. A packet consists of a header, which contains the packet size and addresses of the source and destination hosts, and a payload, which contains data bits sent from the source host.
1. The client on hostAinvokes a system call that copies the data from the client’s virtual address space into a kernel buffer.
2. The protocol software on host A creates a LAN1 frame by appending an internet header and a LAN1 frame header to the data. The internet header is addressed to internet host B. The LAN1 frame header is addressed to the router. It then passes the frame to the adapter. Notice that the payload of the LAN1 frame is an internet packet, whose payload is the actual user data. This kind of encapsulation is one of the fundamental insights of internet working.
3. The LAN1 adapter copies the frame to the network.
4. When the frame reaches the router, the router’s LAN1 adapter reads it from the wire and passes it to the protocol software.
5. The router fetches the destination internet address from the internet packet header and uses this as an index into a routing table to determine where to forward the packet, which in this case is LAN2. The router then strips off the old LAN1 frame header, prepends a new LAN2 frame header addressed to host B, and passes the resulting frame to the adapter. 6. The router’s LAN2 adapter copies the frame to the network. 7. When the frame reaches host B, its adapter reads the frame from the wire and passes it to the protocol software. 8. Finally, the protocol software on host B strips off the packet header and frame header. The protocol software will eventually copy the resulting data into the server’s virtual address space when the server invokes a system call that reads the data.
An IP address is an unsigned 32-bit integer. TCP/IP defines a uniform network byte order (big-endian byte order) for any integer data item.
Each Internet host has the locally defined domain name localhost, which always maps to the loopback address 127.0.0.1
Internet clients and servers communicate by sending and receiving streams of bytes over connections. A connection is point-to-point in the sense that it connects a pair of processes. It is full-duplex in the sense that data can flow in both directions at the same time.
Aserver of this type that iterates through clients, one at a time, is called an iterative server
ToWeb clients and servers, content is a sequence of bytes with an associated MIME
(Multipurpose Internet Mail Extensions) type.
Web servers provide content to clients in two different ways:
. Fetch a disk file and return its contents to the client. The disk file is known as static content and the process of returning the file to the client is known as serving static content.
. Run an executable file and return its output to the client. The output produced by the executable at run time is known as dynamic content, and the process of running the program and returning its output to the client is known as serving dynamic content.
The telnet program is very handy for debugging servers that talk to clients with text lines over connections.
The TINY Web Server: