Data Communications and Networking (Third Edition)

Slides:



Advertisements
Similar presentations
Umut Girit  One of the core members of the Internet Protocol Suite, the set of network protocols used for the Internet. With UDP, computer.
Advertisements

© Janice Regan, CMPT 128, CMPT 371 Data Communications and Networking Socket Programming 0.
1 Chapter 6 Datagram Delivery by UDP Just as the Internet Protocol uses the services of subnetworks, transport protocols build upon the services of IP.
Networks: TCP/IP Socket Calls1 Elementary TCP Sockets Chapter 4 UNIX Network Programming Vol. 1, Second Ed. Stevens.
Socket Programming.
TCP/IP Protocol Suite 1 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 17 Introduction to the Application.
1 Java Networking – Part I CS , Spring 2008/9.
1 L53 Networking (2). 2 OBJECTIVES In this chapter you will learn:  To understand Java networking with URLs, sockets and datagrams.  To implement Java.
CS 311 – Lecture 18 Outline IPC via Sockets – Server side socket() bind() accept() listen() – Client side connect() Lecture 181CS Operating Systems.
Socket Addresses. Domains Internet domains –familiar with these Unix domains –for processes communicating on the same hosts –not sure of widespread use.
McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Application Layer PART VI.
Client Server Model The client machine (or the client process) makes the request for some resource or service, and the server machine (the server process)
What Is TCP/IP? The large collection of networking protocols and services called TCP/IP denotes far more than the combination of the two key protocols.
I NTRODUCTION OF S OCKET P ROGRAMMING L.Aseel AlTurki King Saud University.
Chapter 26 Client Server Interaction Communication across a computer network requires a pair of application programs to cooperate. One application on one.
Process-to-Process Delivery:
TRANSPORT LAYER T.Najah Al-Subaie Kingdom of Saudi Arabia Prince Norah bint Abdul Rahman University College of Computer Since and Information System NET331.
Elementary TCP Sockets
Socket Programming. Introduction Sockets are a protocol independent method of creating a connection between processes. Sockets can be either – Connection.
Chapter 17 Networking Dave Bremer Otago Polytechnic, N.Z. ©2008, Prentice Hall Operating Systems: Internals and Design Principles, 6/E William Stallings.
1 Chapter Client-Server Interaction. 2 Functionality  Transport layer and layers below  Basic communication  Reliability  Application layer.
13/09/2015 Michael Chai; Behrouz Forouzan Staffordshire University School of Computing Transport layer and Application Layer Slide 1.
 Socket  The combination of an IP address and a port number. (RFC 793 original TCP specification)  The name of the Berkeley-derived application programming.
Jozef Goetz, Application Layer PART VI Jozef Goetz, Position of application layer The application layer enables the user, whether human.
Sirak Kaewjamnong Computer Network Systems
Server Sockets: A server socket listens on a given port Many different clients may be connecting to that port Ideally, you would like a separate file descriptor.
CSTP FS01CS423 (cotter)1 Protocols 2 References: RFC’s 791, 793, 768, 826.
Internet Applications and Network Programming Dr. Abraham Professor UTPA.
McGraw-Hill©The McGraw-Hill Companies, Inc., 2000 Chapter 16 Socket Interface
 TCP (Transport Control Protocol) is a connection-oriented protocol that provides a reliable flow of data between two computers.  TCP/IP Stack Application.
Dr. John P. Abraham Professor University of Texas Pan American Internet Applications and Network Programming.
McGraw-Hill©The McGraw-Hill Companies, Inc., 2000 Chapter 16 Socket Interface.
Chapter 2 Applications and Layered Architectures Sockets.
The Socket Interface Chapter 21. Application Program Interface (API) Interface used between application programs and TCP/IP protocols Interface used between.
The Socket Interface Chapter 22. Introduction This chapter reviews one example of an Application Program Interface (API) which is the interface between.
CS 158A1 1.4 Implementing Network Software Phenomenal success of the Internet: – Computer # connected doubled every year since 1981, now approaching 200.
Distributed Computing A Programmer’s Perspective.
TELE202 Lecture 15 Socket programming 1 Lecturer Dr Z. Huang Overview ¥Last Lecture »TCP/UDP (2) »Source: chapter 17 ¥This Lecture »Socket programming.
Position of application layer. Application layer duties.
Introduction to Socket
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 3.1 Internet Applications Ch. 28,… (Client-Server Concept, Use of Protocol Ports, Socket API)
Chapter 27 Socket API Interface The interface between an application program and the communication protocols in an operating system is known as the Application.
Socket Programming Lab 1 1CS Computer Networks.
1 Client-Server Interaction. 2 Functionality Transport layer and layers below –Basic communication –Reliability Application layer –Abstractions Files.
Sockets Socket = abstraction of the port concept: –Application programs request that the operating system create a socket when one is needed –O.S. returns.
Socket Programming Introduction. Socket Definition A network socket is one endpoint in a two-way communication flow between two programs running over.
The Client-Server Model And the Socket API. Client-Server (1) The datagram service does not require cooperation between the peer applications but such.
©The McGraw-Hill Companies, Inc., 2000© Adapted for use at JMU by Mohamed Aboutabl, 2003Mohamed Aboutabl1 1 Chapter 15 Application Layer and Client-Server.
Socket Programming.
2: Application Layer1 Chapter 2: Application layer r 2.1 Principles of network applications r 2.2 Web and HTTP r 2.3 FTP r 2.4 Electronic Mail  SMTP,
Berkeley Socket Abstraction
1 Tips for the assignment. 2 Socket: a door between application process and end- end-transport protocol (UDP or TCP) TCP service: reliable transfer of.
©The McGraw-Hill Companies, Inc., 2000© Adapted for use at JMU by Mohamed Aboutabl, 2003Mohamed Aboutabl1 1 Chapter 16 Socket Interface.
1 Spring Semester 2008, Dept. of Computer Science, Technion Internet Networking recitation #7 Socket Programming.
1 Dimension of Server Designs r Iterative vs Concurrent r Connection-oriented vs. connectionless r Stateful and stateless m Constrained by application.
Netprog: Client/Server Issues1 Issues in Client/Server Programming Refs: Chapter 27.
1 Kyung Hee University Chapter 11 User Datagram Protocol.
McGraw-Hill Chapter 23 Process-to-Process Delivery: UDP, TCP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
1 Network Communications A Brief Introduction. 2 Network Communications.
Client-server communication Prof. Wenwen Li School of Geographical Sciences and Urban Planning 5644 Coor Hall
1 K. Salah Application Layer Module K. Salah Network layer duties.
Process-to-Process Delivery:
Chapter 11 User Datagram Protocol
Sockets and Beginning Network Programming
Client-Server Model and Sockets
Client/Server Example
Process-to-Process Delivery:
Chapter 16 Socket Interface.
Issues in Client/Server Programming
Internet Applications & Programming
Presentation transcript:

Data Communications and Networking (Third Edition) Client-Server Model Data Communications and Networking (Third Edition) by Behrouz A. Forouzan

Client-Server Model Client application program running on the local machine requests a service from another application program – server – running on the remote machine. Commonly server provides service to any client, not a particular client Generally, a client application program that requests a service should run only when it is needed. A server program providing service should run all the time, as it does not know when its services will be needed.

Client-Server Model A client opens the communication channel using IP address of the remote host and the port address of the specific server program running on the host – Active open. Request-response may be repeated several times, the process is finite. The client closes the communication channel with an Active close.

Client-Server Model A server program opens its door for incoming requests from clients but never initiates a service unless explicitly requested – Passive open. A server program is infinite – runs unless a problem occurs. Concurrency in client: two or more clients can run at the same time on a machine – current trend, alternatively: one client must start, run, and terminate before another client may start (iterative).

Client-Server Model Concurrency in server: An iterative server can process only one request at a time whereas a concurrent server can process many requests at the same time – share its time. Connectionless iterative server: the ones that use UDP are iterative, server uses one single port, arriving packets wait in line, Connection oriented concurrent server: the ones that use TCP are normally concurrent,

Client-Server Model A connection is established between server and each client, remains open until the entire stream is processed Each connection requires a port and many connections may remain open simultaneously, Server can use only one well-known port. Solution: use additional ephemeral ports Client makes request through the well-known port, once the connection is made, server assigns a temporary port to this connection.

Client-Server Model => well-known port is free to receive requests for additional connections A program is code (in UNIX) and defines all the variables and actions to be performed on those variables. A process is an instance of a program. An OS creates a process when executing a program, several processes can be created from one program running concurrently.

Client-Server 1. _ can provide a service. An iterative server A concurrent server A client (a) and (b) 2. The client program is _ as it terminates after it has been served. Active Passive Finite Infinite

Client-Server 3. A connection oriented concurrent server uses _ ports. Ephemeral Well-known Active (a) and (b) 4. Machine A requests service X from machine B. Machine B requests service Y from machine A. What is the total number of application programs required? One Two Three Four

Client-Server 5. A server program, once it issues _, waits for clients to request its service. An active open A passive open An active request A finite open 6. _ processes requests one at a time. An iterative client An iterative server A concurrent client A concurrent server

Client-Server 7.In a connection oriented concurrent server, the _ is used for connection only. Ephemeral port Well-known port Infinite port (a) and (b) 8. _ is an instance of a _. Process; service Program; process Process; program Structure; process

Socket Socket: is a construct that supports network input/output. An application creates a socket when it needs a connection to a network. It then establishes a connection to a remote application via the socket. Communication is achieved by reading data from the socket and writing data to it. Socket acts as an endpoint.

Socket A socket is defined in the OS as a structure. Simplified socket structure with five fields: - Family: defines the protocol group (IPv4, IPv6, UNIX domain protocols) - Type: defines the exchange-type (stream, packet, raw) - Protocol: set to zero for TCP/ UDP - Local address: combination of local IP and application port address. - Remote address: combination of remote IP and application port address.

Socket Stream socket: to be used with connection oriented protocol (TCP) Datagram socket: to be used with connectionless protocol (UDP) Raw socket: some protocols (ICMP) directly use the service of IP. Raw sockets are used in these applications.

Socket Connectionless iterative server: receives a request packet from UDP, processes the request, gives response to the UDP to send to the client, Packets are stored in a queue, and processed in order of arrival. Server function: - Create a socket (asks the OS) - Bind (asks the OS to enter information in the socket related to the server – server socket binding)

Socket - Repeats steps infinitely: a) receive a request (asks the OS to wait for a request to this socket and receive it) b) process (by itself) c) send (response sent to the client) • Client function: - Create a socket (asks the OS) - Repeats steps as long as it has requests:

Socket a) send a request (asks the OS) b) receive (asks the OS to wait for a response and deliver it when it has arrived) - Destroy (asks the OS to destroy the socket once requests are exhausted)

Socket Connection oriented concurrent server: A connection for each client, one buffer for each connection Parent and child server: server running infinitely accepting connections is parent, after establishing connection, parent creates child-server and ephemeral ports to handle the client.

Socket Server function: - Create a socket (asks the OS) - Bind (asks the OS to enter information in the socket related to the server – server socket binding) - Listen (asks the OS to be passive and listen to the client - Repeats steps infinitely: a) Create a child (temporary child process is assigned to serve the client, parent is free) b) create a new socket (to be used by the child process)

Socket c) Repeat (the following steps as long as the child has requests from the client) - Read (child reads a stream of bytes from the connection) - Process (the child processes the stream of bytes) - write (the child writes the result as a stream of bytes to the connection) d) Destroy (asks the OS to destroy the temporary socket once the client has been served)

Socket Client function: - Create a socket - Connect (asks the OS to make a connection) - Repeats steps as long as it has data to send: a) Write (sends a stream of bytes to the server) b) Read (receives a stream of bytes from the server) - Destroy (asks the OS to destroy the socket once it has finished)

Socket 1. The _ socket is used with a connection oriented protocol. Stream Datagram Raw Remote 2. The _ socket is used with a connectionless protocol.

Socket 3. The _ socket is used with a protocol that directly uses the services of IP. Stream Datagram Raw Remote 4. A _ server serves multiple clients, handling one request at a time. Connection-oriented iterative Connection-oriented concurrent Connectionless iterative Connectionless concurrent

Socket 5. A _ server serves multiple clients simultaneously. Connection-oriented iterative Connection-oriented concurrent Connectionless iterative Connectionless concurrent

Socket Data structures: sockaddr_in sin_family: 16-bit integer specifying protocol sin_port: 16-bit field specifying port number (application) s_addr: 32-bit Internet address hostent h_name: character string of text address of host

Socket h_alias: alternative names h_addrtype: type of address h_length: Address length h_addr_list: additional addresses

Socket Socket Commands: ‘socket’ – creates a socket ‘gethostbyname’ – returns a host address corresponding to a name ‘gethostname’ – returns the host name ‘connect’ – requests a connection with a remote socket ‘bind’ – assigns an address and port number to a socket

Socket Socket Commands: ‘listen’ – server is ready for connection requests and listens for them ‘accept’ – accepts a connection request over a socket ‘send’ – sends data through a socket ‘recv’ – receives data from a socket ‘close’ – closes a socket

Socket # Does the client or the server or both usually execute each of the following socket commands? Socket b. connect c. bind d. accept e. Listen f. send g. recv h. close

Socket Client server example: outline / framework of socket related calls ‘client and server run concurrently on different machines’

Socket Client: socket (creates a socket) ….. gethostbyname (maps remote host name to an IP address) …… Connect (issues a connection request to a specific server on the remote host)

Socket exchange information using ‘send’ and ‘recv’ commands ….. close (terminate connection) Server: socket (creates a socket) gethostname (get the local host name)

Socket gethostbyname (maps the host name to an IP address) ….. bind ( specifies the IP address and the port number) listen (puts socket in passive mode; ready to accept request)

Socket accept (accepts a connection request) ….. exchange information using ‘send’ and ‘recv’ commands close (terminates current connection)