Client/Server Programming COMP476 Networked Computer Systems • Applications exchange messages through resulting connection • Connecting application uses internet protocol to contact listener • Listening application informs local protocol software that it is ready to accept incoming messages Establishing Contact through IP • Waits for return message • Sends message to server • Client application establishes connection • Returns results • Performs service • Waits for incoming message • Server application is “listener” Client-Server Paradigm Can access multiple services • Must know (or find) the address of server • Initiates contact with server • Runs locally on user's computer • Invoked directly by user • Also performs other computations • Becomes client when network service is needed • Arbitrary application program Characteristics of Client • Will accept requests from arbitrary clients; provides one service to each client • Waits for service requests from clients; loops to wait for next request • Runs on a remote computer (usually centralized, shared computer) • Starts at system initialization time • Special purpose application dedicated to providing network service Characteristics of Server consider streaming audio • Server may send multiple response - • Client may send multiple requests; server sends multiple responses • Server send response, perhaps with data • Client sends request, perhaps with data • Typically, client and server exchange messages: Message Exchanges • Both client and server must have same protocol stack and both interact with transport • Clients and servers exchange messages through transport protocols; e.g., TCP or UDP Transport Protocols and Client-Server Paradigm • Servers run as independent processes and can manage clients simultaneously Multiple Services on One Computer • Failure of single computer can bring down multiple servers • One server can affect others by exhausting computer resources • Reduces management overhead - only one computer to maintain • Can reduce costs by sharing resources among multiple services Multiple Services on One Computer • Thus, client endpoints are unique, and server computer protocol software can deliver messages to correct server process • No two clients on one computer can use same source port • (IP address, port number) on client • (IP address, port number) on server • Each transport session has two unique identifiers • How do incoming messages get delivered to the correct server? Selecting from Multiple Servers – portability - allow the application to be used on different systems – load balancing - select server with lowest utilization – failure recovery - select a different server if original fails – efficiency – avoid many messages or broadcasts • How and when does a client application learn the location of a service? • Goals: Binding of Server Location Write server name in code Read a file of server addresses Broadcast request for a server Ask a human Name server UDDI • Much more on this topic later on • • • • • • Finding a Service • Servers may become clients of other servers • Clients may access different servers for one service • Clients can access multiple services Client-Server Interactions • Often, but not always, there is an application protocol • Clients and servers use transport protocols to communicate • Server waits for client requests • Client requests service when needed • Client-server paradigm used in almost every distributed computation Summary
© Copyright 2026 Paperzz