DOC PREVIEW
Princeton COS 461 - Networked Applications: Sockets

This preview shows page 1-2-3-21-22-23-43-44-45 out of 45 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 45 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 45 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 45 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 45 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 45 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 45 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 45 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 45 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 45 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 45 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Networked Applications: SocketsClass LogisticsSlide 3Goals of Today’s LectureEnd System: Computer on the ‘NetClients and ServersClients Are Not Necessarily HumanClient-Server CommunicationPeer-to-Peer CommunicationClient and Server ProcessesDelivering the Data: Division of LaborSocket: End Point of CommunicationIdentifying the Receiving ProcessUsing Ports to Identify ServicesKnowing What Port Number To UsePort Numbers are Unique on Each HostUNIX Socket APITypical Client ProgramServers Differ From ClientsTypical Server ProgramPutting it All TogetherClient Creating a Socket: socket()Client: Learning Server Address/PortClient: Connecting Socket to the ServerClient: Sending and Receiving DataServer: Server Preparing its SocketServer: Allowing Clients to WaitServer: Accepting Client ConnectionServer: One Request at a Time?Client and Server: Cleaning HouseOne Annoying Thing: Byte OrderEndian Example: Where is the Byte?IP is Big EndianWhy Can’t Sockets Hide These Details?Wanna See Real Clients and Servers?The Web as an Example ApplicationThe Web: URL, HTML, and HTTPExample: HyperText Transfer ProtocolComponents: Clients, Proxies, ServersExample Client: Web BrowserClient: Typical Web TransactionIn Fact, Try This at a UNIX Prompt…Client: Typical Web Transaction (Cont)Web ServerConclusions1Networked Applications: SocketsCOS 461: Computer NetworksSpring 2006 (MW 1:30-2:50 in Friend 004)Jennifer RexfordTeaching Assistant: Ioannis Avramopoulos http://www.cs.princeton.edu/courses/archive/spring07/cos461/2Class Logistics•Slides and reading assignments online at–http://www.cs.princeton.edu/courses/archive/spring07/cos461/–Reading: chapter 1 and socket programming guides•Course e-mail list–https://lists.cs.princeton.edu/mailman/listinfo/cos461–Test e-mail sent out yesterday (didya get it?)•Ioannis Avrampoulos’ office hours–Saturdays 4:00-5:00pm at Cafe Vivian–Wednesdays 12:00-1:00pm in CS 2123Class Logistics•Computer accounts in FC 010–CS account (can request a CS “class account”)https://csguide.cs.princeton.edu/requests/accountSSH to portal.cs.princeton.edu with your CS account–Account on FC 010For students who are enrolled in the class SSH to labpc-XX.cs.princeton.edu with OIT password•Programming assignment #0–Client and server programs to copy and print data–Assignment will be posted later this week–Due 9am on Monday February 194Goals of Today’s Lecture•Client-server paradigm–End systems–Clients and servers•Sockets–Socket abstraction–Socket programming in UNIX•HyperText Transfer Protocol (HTTP)–URL, HTML, and HTTP–Clients, proxies, and servers–Example transactions using sockets5End System: Computer on the ‘NetInternetAlso known as a “host”…6Clients and Servers•Client program–Running on end host–Requests service–E.g., Web browser•Server program–Running on end host–Provides service–E.g., Web serverGET /index.html“Site under construction”7Clients Are Not Necessarily Human•Example: Web crawler (or spider)–Automated client program–Tries to discover & download many Web pages–Forms the basis of search engines like Google•Spider client–Start with a base list of popular Web sites–Download the Web pages–Parse the HTML files to extract hypertext links–Download these Web pages, too–And repeat, and repeat, and repeat…8Client-Server Communication•Client “sometimes on”–Initiates a request to the server when interested–E.g., Web browser on your laptop or cell phone–Doesn’t communicate directly with other clients–Needs to know the server’s address•Server is “always on”–Services requests from many client hosts–E.g., Web server for the www.cnn.com Web site–Doesn’t initiate contact with the clients–Needs a fixed, well-known address9Peer-to-Peer Communication•No always-on server at the center of it all–Hosts can come and go, and change addresses–Hosts may have a different address each time•Example: peer-to-peer file sharing–Any host can request files, send files, query to find a file’s location, respond to queries, …–Scalability by harnessing millions of peers–Each peer acting as both a client and server10Client and Server Processes•Program vs. process–Program: collection of code–Process: a running program on a host•Communication between processes–Same end host: inter-process communicationGoverned by the operating system on the end host–Different end hosts: exchanging messagesGoverned by the network protocols•Client and server processes–Client process: process that initiates communication–Server process: process that waits to be contacted11Delivering the Data: Division of Labor•Network–Deliver data packet to the destination host–Based on the destination IP address•Operating system–Deliver data to the destination socket–Based on the destination port number•Application–Read data from and write data to the socket–Interpret the data (e.g., render a Web page)12Socket: End Point of Communication•Sending message from one process to another–Message must traverse the underlying network•Process sends and receives through a “socket”–In essence, the doorway leading in/out of the house•Socket as an Application Programming Interface–Supports the creation of network applicationssocket socketUser processUser processOperatingSystemOperatingSystem13Identifying the Receiving Process•Sending process must identify the receiver–The receiving end host machine–The specific socket in a process on that machine•Receiving host–Destination address that uniquely identifies the host–An IP address is a 32-bit quantity•Receiving socket–Host may be running many different processes–Destination port that uniquely identifies the socket–A port number is a 16-bit quantity14Using Ports to Identify ServicesWeb server(port 80)Client hostServer host 128.2.194.242Echo server(port 7)Service request for128.2.194.242:80(i.e., the Web server)Web server(port 80)Echo server(port 7)Service request for128.2.194.242:7(i.e., the echo server)OSOSClientClient15Knowing What Port Number To Use•Popular applications have well-known ports–E.g., port 80 for Web and port 25 for e-mail–See http://www.iana.org/assignments/port-numbers•Well-known vs. ephemeral ports–Server has a well-known port (e.g., port 80)Between 0 and 1023–Client picks an unused ephemeral (i.e., temporary) portBetween 1024 and


View Full Document

Princeton COS 461 - Networked Applications: Sockets

Documents in this Course
Links

Links

39 pages

Lecture

Lecture

76 pages

Switches

Switches

35 pages

Lecture

Lecture

42 pages

Links

Links

39 pages

Lecture

Lecture

34 pages

Topology

Topology

42 pages

Lecture

Lecture

42 pages

Overview

Overview

42 pages

Sockets

Sockets

45 pages

Load more
Download Networked Applications: Sockets
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Networked Applications: Sockets and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Networked Applications: Sockets 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?