1 CS 455/555 Intro to Networks and Communications Client/Server Computing and Socket Programming (2.1, 2.7-2.8) Michele Weigle Department of Computer Science.

Slides:



Advertisements
Similar presentations
Application Layer 2-1 Chapter 2 Application Layer Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Application Layer – Lecture.
Advertisements

EEC-484/584 Computer Networks Lecture 3 Wenbing Zhao (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.
Application Layer-11 CSE401N: Computer Networks Lecture-4 Application Layer Overview HTTP.
2: Application Layer 1 Socket programming Socket API r introduced in BSD4.1 UNIX, 1981 r explicitly created, used, released by apps r client/server paradigm.
1 Creating a network app Write programs that  run on different end systems and  communicate over a network.  e.g., Web: Web server software communicates.
2: Application Layer1 Chapter 2: Application Layer Our goals: r conceptual, implementation aspects of network application protocols m transport-layer service.
1 Application Layer. 2 Writing Networked Applications TCP UDP IP LL PL TCP UDP IP LL PL TCP UDP IP LL PL Web Browser Web Server Ftp Server Ftp Client.
1 Overview r Socket programming with TCP r Socket programming with UDP r Building a Web server.
Internet and Intranet Protocols and Applications Lecture 4: Application Layer 3: Socket Programming February 8, 2005 Arthur Goldberg Computer Science Department.
2: Application Layer1 Chapter 2 Application Layer Computer Networking: A Top Down Approach Featuring the Internet, 3 rd edition. Jim Kurose, Keith Ross.
Some slides are in courtesy of J. Kurose and K. Ross Review of Previous Lecture Network access and physical media Internet structure and ISPs Delay & loss.
1 School of Computing Science Simon Fraser University CMPT 771/471: Internet Architecture and Protocols Socket Programming Instructor: Dr. Mohamed Hefeeda.
Introduction to the Application Layer Computer Networks Computer Networks Spring 2012 Spring 2012.
2: Application Layer1 Chapter 2: Application Layer Our goals: r conceptual, implementation aspects of network application protocols m transport-layer service.
2: Application Layer1 Socket Programming. 2: Application Layer2 Socket-programming using TCP Socket: a door between application process and end- end-transport.
1 Network Layers Application Transport Network Data-Link Physical bits.
1 An Overview of Applications Xin Liu ECS 152A Ref: slides by J. Kurose and K. Ross.
1 Computer Networks Transport Layer Protocols. 2 Application-layer Protocols Application-layer protocols –one “piece” of an app –define messages exchanged.
Some slides are in courtesy of J. Kurose and K. Ross Review of Previous Lecture Network access and physical media Internet structure and ISPs Delay & loss.
Dr. Philip Cannata 1 Principles of Network Applications.
Introduction 1 Lecture 5 Application Layer slides are modified from J. Kurose & K. Ross University of Nevada – Reno Computer Science & Engineering Department.
Julia Ljunbjörk and Anita Mugenyi. What is a socket? Like a house Between the layers.
Chapter 2 Application Layer Computer Networking: A Top Down Approach, 5 th edition. Jim Kurose, Keith Ross Addison-Wesley, April A note on the use.
2: Application Layer 1 Socket Programming TCP and UDP.
Chapter 2, slide: 1 CS 372 – introduction to computer networks* Monday June 28 Announcements: r Lab 1 is due today r Lab 2 is posted today and is due next.
2: Application Layer1 Chapter 2 Application Layer These slides derived from Computer Networking: A Top Down Approach, 6 th edition. Jim Kurose, Keith Ross.
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,
2: Application Layer1 Socket programming Socket API r introduced in BSD4.1 UNIX, 1981 r explicitly created, used, released by apps r client/server paradigm.
Throughput: Internet scenario
Application Layer 2-1 Chapter 2 Application Layer Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Addison-Wesley March 2012.
CS 3830 Day 11 Introduction : Application Layer 2 Server-client vs. P2P: example Client upload rate = u, F/u = 1 hour, u s = 10u, d min ≥ u s.
2: Application Layer1 Some network apps r r Web r Instant messaging r Remote login r P2P file sharing r Multi-user network games r Streaming stored.
19-1 Last time □ TCP ♦ Throughput ♦ Fairness ♦ Delay modeling □ TCP socket programming.
CHAPTER 2. Creating a network app write programs that – run on (different) end systems – communicate over network – e.g., web server software communicates.
1 Application Layer Lecture 4 Imran Ahmed University of Management & Technology.
Chapter Two Application Layer Prepared by: Dr. Bahjat Qazzaz CS Dept. Sept
CS 3830 Day 7 Introduction : Application Layer 2 Processes communicating Process: program running within a host. r within same host, two processes.
 Socket  The combination of an IP address and a port number. (RFC 793 original TCP specification)  The name of the Berkeley-derived application programming.
What makes a network good? Ch 2.1: Principles of Network Apps 2: Application Layer1.
Internet Engineering Course Application Layer Protocols.
2: Application Layer 1 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,
Discussion 2 Sockets Programming Applets TCP UDP HTTP Delay Estimation
Winter 2002Suprakash Datta1 Socket programming Socket API introduced in BSD4.1 UNIX, 1981 explicitly created, used, released by apps client/server paradigm.
-1- Georgia State UniversitySensorweb Research Laboratory CSC4220/6220 Computer Networks Dr. WenZhan Song Associate Professor, Computer Science.
Vassil Roussev 2 A socket is the basic remote communication abstraction provided by the OS to processes. controlled by operating system.
Socket Programming Lee, Sooyong
Sockets process sends/receives messages to/from its socket
Socket Programming Tutorial. Socket programming Socket API introduced in BSD4.1 UNIX, 1981 explicitly created, used, released by apps client/server paradigm.
2: Application Layer1 Chapter 2 Application Layer Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Addison-Wesley March 2012.
Application Layer 2-1 Chapter 2 Application Layer Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Addison-Wesley March 2012.
1 End-user Protocols, Services and QoS. 2 Layering: logical communication application transport network link physical application transport network link.
Application Layer 2-1 Chapter 2 Application Layer Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Addison-Wesley March 2012.
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,
2: Application Layer1 Socket programming Socket API Explicitly created, used, released by apps Client/server paradigm Two types of transport service via.
2: Application Layer1 Chapter 2 Application Layer Computer Networking: A Top Down Approach Featuring the Internet, 3 rd edition. Jim Kurose, Keith Ross.
2: Application Layer 1 Chapter 2 Application Layer Computer Networking: A Top Down Approach, 5 th edition. Jim Kurose, Keith Ross Addison-Wesley, April.
1 Socket programming Socket API r introduced in BSD4.1 UNIX, 1981 r explicitly created, used, released by apps r client/server paradigm r two types of.
1 COMP 431 Internet Services & Protocols Client/Server Computing & Socket Programming Jasleen Kaur February 2, 2016.
Socket programming in C. Socket programming Socket API introduced in BSD4.1 UNIX, 1981 explicitly created, used, released by apps client/server paradigm.
Ch 2. Application Layer Myungchul Kim
Data Communications and Computer Networks Chapter 2 CS 3830 Lecture 11 Omar Meqdadi Department of Computer Science and Software Engineering University.
@Yuan Xue CS 283Computer Networks Spring 2011 Instructor: Yuan Xue.
Chapter 7 Application Layer 1 Some of the slides in this chapter are courtesy of Profs. Kurose/Ross and others.
A special acknowledge goes to J.F Kurose and K.W. Ross Some of the slides used in this lecture are adapted from their original slides that accompany the.
Socket Programming original by Joonbok Lee KAIST heavily adapted by /Jens.
Chapter 2 Application Layer
Introduction to Networks
Chapter 2 Introduction Application Requirements VS. Transport Services
Socket programming - Java
Presentation transcript:

1 CS 455/555 Intro to Networks and Communications Client/Server Computing and Socket Programming (2.1, ) Michele Weigle Department of Computer Science Old Dominion University

2 Application-Layer Protocols Overview  Application-layer protocols define: »The types of messages exchanged »The syntax and semantics of messages »The rules for when and how messages are sent  Public protocols (defined in RFCs) »HTTP, FTP, SMTP, POP, IMAP, DNS  Proprietary protocols »RealAudio, RealVideo »IP telephony »… local ISP company network regional ISP application transport network link physical application transport network link physical application

3 Network Working Group R. Fielding UC Irvine Request for Comments: 2616 J. Gettys Compaq/W3C Obsoletes: 2068 J. Mogul Compaq Category: Standards Track H. Frystyk W3C/MIT L. Masinter Xerox June 1999 P. Leach Microsoft T. Berners-Lee W3C/MIT Hypertext Transfer Protocol -- HTTP/1.1 Abstract The Hypertext Transfer Protocol (HTTP) is an application-level protocol for distributed, collaborative, hypermedia information systems. It is a generic, stateless, protocol which can be used for many tasks beyond its use for hypertext, such as name servers and distributed object management systems, through extension of its request methods, error codes and headers [47]. A feature of HTTP is the typing and negotiation of data representation, allowing systems to be built independently of the data being transferred. HTTP has been in use by the World-Wide Web global information initiative since This specification defines the protocol referred to as "HTTP/1.1", and is an update to RFC 2068 [33].

4 Application-Layer Protocols Outline  The architecture of distributed systems »Client/Server computing »P2P computing »Hybrid (Client/Server and P2P) systems  The programming model used in constructing distributed systems »Socket programming  Example client/server systems and their application-level protocols »The World-Wide Web (HTTP) »Reliable file transfer (FTP) » (SMTP & POP) »Internet Domain Name System (DNS) local ISP company network regional ISP application transport network link physical application transport network link physical application

5 Application-Layer Protocols Outline local ISP company network regional ISP  Protocol design issues: »In-band v. out-of-band control signaling »Push v. pull protocols »Persistent v. non-persistent connections  Client/server service architectures »Contacted server responds versus forwards request  Example client/server systems and their application-level protocols »The World-Wide Web (HTTP) »Reliable file transfer (FTP) » (SMTP & POP) »Internet Domain Name System (DNS) application transport network link physical application transport network link physical application

6 local ISP company network regional ISP Application-Layer Protocols Client-Server Architecture Server: »always-on host »permanent IP address »server farms for scaling Clients: »communicate with server »may be intermittently connected »may have dynamic IP addresses »do not communicate directly with each other

7 Application-Layer Protocols Pure P2P Architecture  Not always-on server  Arbitrary end systems directly communicate  Peers are intermittently connected and change IP addresses  Example: Gnutella Highly scalable But difficult to manage local ISP company network regional ISP

8 Application-Layer Protocols Hybrid of Client-Server and P2P Napster »File transfer P2P »File search centralized:  Peers register content at central server  Peers query same central server to locate content Instant messaging »Chatting between two users is P2P »Presence detection/location centralized:  User registers its IP address with central server when it comes online  User contacts central server to find IP addresses of buddies

9 Application-Layer Protocols Transport Services Data loss  Some apps (e.g., audio) can tolerate some loss  Other apps (e.g., file transfer, telnet) require 100% reliable data transfer Timing  Some apps (e.g., Internet telephony, interactive games) require low delay to be “effective” Bandwidth  Some apps (e.g., multimedia) require minimum amount of bandwidth to be “effective”  Other apps (“elastic apps”) make use of whatever bandwidth they get

10 Internet Applications Transport Service Requirements Application file transfer Web documents real-time audio/video stored audio/video interactive games instant messaging Data loss no loss loss-tolerant no loss Bandwidth elastic audio: 5kbps-1Mbps video:10kbps-5Mbps same as above few kbps up elastic Time Sensitive no yes, 100’s msec yes, few secs yes, 100’s msec yes and no

11 Internet Transport Protocols Services Provided  TCP service: »connection-oriented: setup required between client, server »reliable transport between sending and receiving process »flow control: sender won’t overwhelm receiver »congestion control: throttle sender when network overloaded »does not provide: timing, minimum bandwidth guarantees  UDP service: »unreliable data transfer between sending and receiving process »does not provide: connection setup, reliability, flow control, congestion control, timing, or minimum bandwidth guarantees Why bother? Why is there a UDP?

12 Internet Applications Application and Transport Protocols Application remote terminal access Web file transfer streaming multimedia Internet telephony Application layer protocol SMTP [RFC 2821] Telnet [RFC 854] HTTP [RFC 2616] FTP [RFC 959] HTTP (YouTube), proprietary (RealNetworks) proprietary (e.g., Skype) Underlying transport protocol TCP TCP or UDP typically UDP

13 local ISP company network regional ISP The Application Layer The client-server paradigm  Typical network application has two pieces: client and server  Client: »Initiates contact with server (“speaks first”) »Requests service from server »For Web, client is implemented in browser; for , in mail reader  Server: »Provides requested service to client »“Always” running »May also include a “client interface” reply request Client Server application transport network link physical application transport network link physical application transport network link physical application transport network link physical application

14 Client/Server Paradigm Socket programming  Sockets are the fundamental building block for client/server systems  Sockets are created and managed by applications »Strong analogies with files a host-local, application created/released, OS-controlled interface into which an application process can both send and receive messages to/from another (remote or local) application process socket  Two types of transport services are available via the socket API: »UDP sockets: unreliable, datagram-oriented communications »TCP sockets: reliable, stream-oriented communications

15 Client/Server Paradigm Socket-programming using TCP  A socket is an application created, OS-controlled interface into which an application can both send and receive messages to and from another application »A “door” between application processes and end-to-end transport protocols process TCP with buffers, variables socket controlled by application developer controlled by operating system Host (end system) process TCP with buffers, variables socket controlled by application developer controlled by operating system Host (end system) Internet

16 Socket Programming using TCP TCP socket programming model  A TCP socket provides a reliable bi-directional communications channel from one process to another »A “pair of pipes” abstraction Process socket Host (end system) Host (end system) Internet Process socket bytes write read writeread

17 TCP with buffers, variables TCP with buffers, variables Socket Programming using TCP Network addressing for sockets process socket End System process socket Local port numbers (e.g., 6500) Internet domain name of host e.g., cash.cs.odu.edu DNS  Sockets are addressed using an IP address and port number Internet addresses of hosts (e.g., )

18 Socket Programming using TCP Socket programming in general  When the client creates a socket, the client’s TCP establishes connection to server’s TCP  When contacted by a client, server creates a new socket for server process to communicate with client »This allows the server to talk with multiple clients  Client creates a local TCP socket specifying the IP and port number of server process »if necessary, client resolves IP address from hostname  Client contacts server »Server process must be running »Server must have created socket that “welcomes” client’s contact Client socket Internet Server socket bytes write read writeread

19 Socket Programming using TCP Socket creation in the client-server model process host or server Internet process bytes TCP 3-way handshake Client Server 3-way handshake Client client socket “welcoming” socket connection socket bytes socket

20 Socket Programming with TCP - Example Client structure  Client reads from standard input ( inFromUser stream), writes to server via a socket ( outToServer stream)  Server reads line from a socket  Server converts line to uppercase and writes back to client  Client reads from socket, ( inFromServer stream) prints modified line to standard output client socket inFromServer outToServer inFromUser Client Process (1) (2) (3) Standard output (4) Standard input

21 Socket Programming with TCP - Example Client/server TCP socket interaction in Java create socket for incoming request (port=6789) welcomeSocket = new ServerSocket(...) wait for incoming connection request connectionSocket = welcomeSocket.accept() create socket, connect to cash.cs.odu.edu, port=6789 clientSocket = new Socket(...) close connectionSocket close clientSocket Server (running on cash.cs.odu.edu) Client (running on tango.cs...) read reply from clientSocket write request using clientSocket read request from connectionSocket write reply to connectionSocket TCP connection setup program flow data flow

22 Socket Programming using UDP UDP socket programming model  A UDP socket provides an unreliable bi-directional communication channel from one process to another »A “datagram” abstraction Host (end system) Host (end system) Process socket Internet Process socket bytes write read writeread

23 Socket Programming with UDP - Example Client/server UDP socket interaction in Java create socket for incoming request (port=9876) serverSocket = new DatagramSocket() create socket, clientSocket = new DatagramSocket() read reply from clientSocket create address (cash.cs.odu.edu, port = 9876) and send datagram using clientSocket read request from serverSocket write reply to serverSocket specifying client IP address and port number program flow data flow Server (running on cash.cs.odu.edu) Client close clientSocket

24 Socket Programming Out of Class Practice Exercises  Modify the TCPClient so that it doesn’t quit after receiving the reply (allow the user to send and receive multiple messages)  Run one server and connect multiple clients to the same server to see how they are handled.  Modify the TCPServer so that it prints the IP address and port of the connected client.  Do the same for UDPClient and UDPServer

25 Socket Programming Message Boundaries  TCP does not preserve message boundaries »just a stream of bytes »one call to readLine() may return data from multiple packets  using BufferedReader in Java hides this  UDP does preserve message boundaries »datagrams are separate entities »one call to receive() returns only a single datagram