120 likes | 228 Views
Chapter 26 Client Server Interaction. Communication across a computer network requires a pair of application programs to cooperate. One application on one computer initiates communication and the other computer accepts the contact request. Client-Server Paradigm.
E N D
Chapter 26 Client Server Interaction • Communication across a computer network requires a pair of application programs to cooperate. • One application on one computer initiates communication and the other computer accepts the contact request.
Client-Server Paradigm • A server is an application program that waits passively for contact • a client is an application program that actively initiates communication with a server. • A server application that expects communication must interact with protocol software before an external source (client) attempts to communicate(fig 26.1). • server application notifies the local protocol software that a specific type of message is expected • server application then waits for a client application to actively initiate interaction
Server Software • a special-purpose, privileged program dedicated to providing one service, but can handle multiple remote clients at the same time. • is invoked automatically when a system boots • runs on a shared computer that has powerful hardware and sophisticated operating system • waits passively for contact from any remote client • accepts contact from clients, but offers a single service • Eg. Telnetd, ftpd, named, httpd
Client Software • An application program that becomes a client temporarily when remote access is needed. • Invoked by a user, and executes for only one session • Runs locally on user’s computer • Actively initiates contact with server • Does not require sophisticated operating system
Direction of Data Flow • a client usually sends a request to a server, and the server returns a response to the client. • It’s possible for the client to send one request and the server to send a response and continuous updates (eg. Weather program) • It’s possible for server to export and import information (eg. File server) • Hence, information can flow in either or both directions between a client and server.
Client/Server Interaction with Transport Layer Protocol • Transport protocols (eg. TCP, UDP) assign each service a unique identifier. • Both clients and servers specify the service identifier • protocol software uses the identifier to direct each incoming request to the correct server application(fig 26.2)
TCP Port Number • TCP uses a 16-bit integer known as protocol port numbers to identify services. • A unique port number is assigned to each service • A server specifies the port number for the service it offers. • A client specifies the port number of the desired service when sending a request • TCP software uses the port number in an incoming message to determine which server to receive the request. • well-known port numbers
Handling Multiple Clients • A concurrent (mutitasking) file server can handle multiple clients simultaneously. • A separate copy (process or thread) of the server handles each request. • Each new request is handle by forking a new child process while the parent process waits for new requests.
Source and Destination Ports • Each client application is assigned a port number in SOURCE port field and a port number of the server in the DESTINATION port field. • TCP software on the server’s machine uses the combination of client and server port numbers (as well as client and server IP addresses) to choose the correct copy of a concurrent server
TCP vs. UDP • Clients and servers can use either connection-oriented (eg. TCP) or connectionless (eg. UDP) transport protocols to communicate. • Some servers may support both TCP and UDP