Client-server Systems
Transcription
Client-server Systems
Client-server Systems 1 Distributed System Architecture • A distributed system is a system in which: – Many computers are connected together in a network or internetwork. – Software and/or hardware on these computers co-operate in an organized manner to perform a given system task. – Computations are performed simultaneously. – Hosts communicate on a peer-to-peer basis. Host 3 Host 1 Internetwork Host 2 Host n 2 The Client-server Architecture Specialization of a Distributed System • One or more computers in the network is designated as server, and the other computers are called clients –Server: • • • –Client • A program that provides a service for other programs that connect to it. A server program runs on a host, collectively called “the server.” A server may be accessed by many clients simultaneously. A program on a host that accesses a server (s) to obtain services. Host Computer (Host) Client 1 Host Computer (Host) Client 3 Server Computer (Server) Server 1 Host Computer (Host) Client 2 Host Computer (Host) Client n 3 Examples of Client-server Systems The World Wide Web (WWW) Email Domain Name Server (DNS) File Transfer Protocol (FTP) Is the Internet’s equivalent of a phone book. It maintains a directory of domain names and translates them to Internet Protocol (IP) addresses. This is necessary because, although domain names are easy for people to remember, computers or machines, access websites based on IP addresses. Allows a client program to have remote access of files on the server. Telnet Is a TCP based network protocol that allows a user on Computer A to log onto another Computer B and use the facilities of the Computer B, such as accessing OS commands and operating or configuring peripherals connected to Computer B. Telnet allows a user to do a “remote login” to a computer. Normally, a user must have an account to login to Computer B. Since telnet is unsecure, it has been replaced by telnet/ssh, which encrypts all messages. 4 Advantages of Client-server Systems Work can be distributed among different machines Example: a server can be used as a central controller, which sends tasks to client machines that execute the tasks simultaneously and report back the results to the server/controller. The client and server can be designed separately. They can both be simpler. Competing clients can be written to communicate with the same server, and vice-versa. 5 Advantages of Client-server Systems All the data can be kept centrally at the server. Conversely, data can be distributed among many different geographically-distributed clients or servers. The server can be accessed simultaneously by many clients. 6 Thin-client system Client’s code is as simple as possible (low responsibility) Most of the work is done by the server (high responsibility) Example: A diskless computer terminal, in which all keyboard/mouse commands are sent to a server computer, which does all of the work. Fat-client system – As much work as possible is delegated to the clients – Server can handle more clients. 7 Technology Needed To Build Client-server Systems Layered Communications Software Architecture Communications Protocols Identification of Network Based Programs 8 The Need For Layered Software Architecture (1) Host A (Computer A) Internet Host B (Computer B) Router Physical Communications Channel (network) Different types of physical communications channels on a network are possible Ethernet, WiFi, Bluetooth, Zigbee, Asynchronous Transfer Mode (ATM), etc. Each different type of channel requires a different communications interface card to be placed on the host machine for that host to connect and take part in communications on that network. For example, an Ethernet Network Interface Card (NIC) is required to be installed on a host for that host to take part in communications on an Ethernet. Software on the host is required to run each of the interface cards. 9 The Need For Layered Software Architecture (2) If the software was written all in one layer, i.e., the user interface, computational components, opening network connection, and sending data on the network, then whenever the physical channel to which a computer was attached changed, then the software would need to be rewritten and recompiled with the code required for the new physical channel. Network communications software is usually implemented by the OS. Imagine if you had to recompile and reinstall the OS each time you wanted to use a different communications channel. Communications software should be designed in layers, so that if the physical channel changes, only the layer that deals with communications on the physical channel needs to be updated. 10 Communications Protocol Analogy Communicating Letters User Program and Application Layer: – – Transport Layer: – – Respective moms sending and receiving letters for their children. A Mom communicating with another Mom, using their specific language and set of rules for communication (protocol). Network Layer: – – Children writing, exchanging, and reading letters across Canada. A child in Winnipeg communicating with another child in Vancouver, using their specific language and a set of rules for communication (protocol). Canada Post (CP), letter routing between or within cities. CP depot communicating with another CP depot along the route between the two cities, using their specific language and set of rules for communication (protocol). The route the letters take could have many different channels (walking, bicycle, car, bus, train, and air plane), each of which has a pair of depots at the channel boundaries. Data Link Layer: – – The actual sending of the letter from source to destination could use several different channels, such as walking, bicycle, car, bus, train, and air plane. For each channel, two nodes use a specific language and set of rules for communication (protocol). 11 Virtual and Actual Communications Paths A Program running on Host A sends a packet of data to a program running on Host B, virtually, using an Applications Layer Communications Protocol. Actually, Program A passes the packet to its Transport Layer, which uses a Transport Layer Communications Protocol to communicate with its peer, virtually. Actually, the Transport Layer then sends the packet to the next layer, and so on. The packet is eventually received by the Data Link Layer at the destination Host B. The Data Link Layer at Host B sends the packet up the stack until it is received by Program B. 12 Program A sends its data to the Transport Layer, which encapsulates Program A’s data into a Transport Layer packet, consisting of a header and the data Transport (called, the payload). Header The Transport Layer sends its packet to the Network Layer, which encapsulates the Link data into a Network Header Layer packet. Network Header Application Data Transport Data Network Data Data Link Data Link Footer The Network Layer sends its packet to the Data Link Layer, which encapsulates the data into a Data Link Layer packet. The Link Layer packet is sent across the network, going through routers, until it is received by the destination, Host B. Each layer of Host B’s protocol stack, starting from the Link Layer reads the packet, stripping off their header/footer and passing the remaining part to the next higher layer, until the application data is received by the Application Layer of Program B. 13 Each layer in the stack uses a unique language and set of rules of communication for that layer. For example, in the Applications Layer: The finite messages Program A sends to Program B form a language. • Program B has to be programmed to understand Program B’s language, and to abide by the rules of communications set out by the designers of the protocol of that layer. The finite messages Program B sends to Program A form a language. • Program A has to be programmed to understand Program A’s, and to abide by the rules of communications set out by the designers of the protocol of that layer. The two languages and the rules of the conversation, taken together, are called the communications protocol for that layer. 14 Network Based Software Structured In Layers • • • • TCP/IP stack consists of four layers. Each layer has a specific set of responsibilities. Each layer invokes API functions of the layer below it. Messages start from the transmitter network based program and flow down the stack, across the physical network, up the stack at the receiver, and are finally received by the receiver network based program. A network based program is situated at the Application Layer. You can write software for this entire layer, or only a portion of this layer and use given libraries. Implemented by other software, such as the OS. Network Based Program Compiler Libraries Application Layer (HTTP, POP, telnet, Custom, …) API Transport Layer (TCP, UDP, …) API Network Layer (IP, …) API Link Layer (Ethernet, WiFi, …) 15 • Two major protocols in the transport layer can be used: – TCP and UDP. • TCP (Transmission Control Protocol) – Is a protocol that provides a reliable flow of data packets between two programs. – The data is guaranteed to be delivered. • UDP (User Datagram Protocol) – Is a protocol that sends packets of data, called datagrams, from one program to another, with no guarantees of delivery. 16 Responsibilities of a Network Based Program A network based program: – – – Has a user interface, as required; Manipulates application specific data, as required; Implements algorithms and functions to operate on the data. – – Implements a peer-to-peer communications protocol. Can use a fully custom protocol to communicate with a peer, which will include a custom carrier upon which application specific messages will be communicated with a peer. Or can use an existing carrier protocol, such as HTTP and telnet, to carry your custom application specific protocol to communicate with a peer. – – – – Generates payload data to be sent to a peer. Passes payload to the next layer (Transport Layer), by calling the API of the Transport Layer. Receives payload from its peer by receiving payload from the Transport Layer. 17 Our Network Based Program Development Experience • In this course you will gain experience developing network based programs incrementally at different levels of increasing completeness: – Simplest version: Use a given TCP client on your workstation (WS) • Use a telnet client program on your WS to connect to a given TCP server host on the MX7cK board. • Once connected use telnet’s command line interface to send and receive text messages. – Intermediate version: Create a TCP server on the MX7cK board, but still use telnet on the client WS. • Add a C function, which performs as a TCP server, to the existing software on the TCP/IP stack of the MX7cK board. • This server could be an “echo” server, which simply returns the received text message back to the client. • This server could be a push-button and LED server, which accepts push-button and LED commands, and executes them, such as returning the state of the push-buttons and LEDs, or switching the LEDs on/off. – Create a complete Java based TCP/IP client and server and deploy them on WSs over the University network, and connect a Java based client on a WS and use your C based TCP server on the MX7cK. – Extend the Java based TCP/IP client and server to a framework. – Apply the framework to a smartphone, which is acting as a client, and which connects to the server built from the framework and deployed on a WS. 18 Identification of Network Based Programs: Host A (Computer A) PGM1 PGM2 PGMn Port#1 Port#3 Port#n Host B (Computer B) PGM1 PGM2 Port#1 Port#3 TCP/IP Stack TCP/IP Stack NIC1 NIC2 IP Address1 IP Address2 NIC1 IP Address1 Internet 19 Programs communicate with each other across the Internet by exchanging packets of data. A source program must know the destination program’s ID to properly address the destination program and send packets to it. A program running on a specific computer (Host) can be identified on the network by two identifiers: – Host’s Address (address of NIC on the computer): 3 types of identifiers: • Hostname, IP Address, MAC Address • Identifies the host (computer) on the network – Port number • Identifies the network based program running on the host. 20 General Structure Example Host Name Text: can be changed MX79 IP Address Number: can be changed 192.168.1.79 MAC Address Fixed 00-18-3E-01-11-79 21 The IP address identifies the computer (Host) – – The IP address identifies the specific Network Interface Card (NIC) that is installed on a Host. Since a Host may have more than one NIC, there may be more than one IP address associated with a Host. The IP address can be represented by two equivalent identifiers: – A hostname, for example: www.google.ca, localhost, MX79 • A DNS server translates hostname to IP address – A 32-bit IP address, specified as 4 bytes in decimal, for example: 72.14.253.147 22 Since many network programs may be running on a single host, the programs are identified by the Port number. Ports are identified by a 16-bit number. Port numbers range from 0 to 65,535 because ports are represented by 16-bit numbers. The port numbers ranging from 0 - 1023 are restricted: – They are reserved for use by well-known services, such as HTTP and FTP and other system services. – These ports are called well-known ports. – Your applications should not attempt to bind to them. 23
Similar documents
PRACTICE QUESTIONS ON RESOURCE ALLOCATION QUESTION 1: Internet Versus Station Wagon
More information
What Is The Internet (And What Makes It Work) -... By Rob ert E. K ahn a nd Vinton G....
More information