DOC PREVIEW
U of I CS 241 - System Programming

This preview shows page 1-2-3-26-27-28 out of 28 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 28 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 28 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 28 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 28 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 28 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 28 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 28 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Naming and TCP ApplicationsCS241 AdministrativeHost Names and IP AddressesInternet Domain NamesDomain Naming System (DNS)IP AddressConversion of Host Name to IP AddressExampleConversion from Address to name ExampleAnother approach to Conversion TCP/IP Application – Electronic Mail TCP/IP Application – File TransferTCP Application - TelnetTCP Application – World Wide WebWeb Markup Language - HTMLWeb Content (1)Web Content (2)HTTP Web ProtocolClient Requests/Server Response HTTP Message ExchangeTCP/IP Application: Remote Procedure Call (RPC)RPC MechanismRPC ImplementationGood Analogy?Java Remote Method InvocationRMISummaryCS 241 Spring 2007System Programming1Naming and TCP ApplicationsLecture 37Klara Nahrstedt2CS241 Administrative Read Stallings Chapter 13, 14.4. R&R 18.8 and 19.1-3 LMP3 (Part II) Due April 30 Last Regular Quiz will be on Friday, April 27 on Networking Homework 2 posted – Due Wednesday, May 2, 4pm Monday, April 30  We will have LMP3 Quiz We will have guest lecture – speaker from Mathematica talking about challenges of Mathematica Development on Different OS Platforms (UNIX, MAC, Linux, Windows).  Wednesday, May 2 – In Class Review Session for Final Exam3Host Names and IP AddressesInternet Users use Host Namescsil-linux1.cs.uiuc.educsil-linux3.cs.uiuc.eduHost names must be mapped to numeric network addresses for most of the network library callsSystem admins define mechanisms by which names are translated into network addressesHost names are stored in ASCII strings4Internet Domain NamesSet of Domain names forms a hierarchy - treeICANN (Internet Corporation for AssignedNames and Numbers)Example:csil-linux1.cs.uiuc.educsil-linux3csuiuc mitberkeleyedugov comUnnamed rootamazonwww208.216.181.15128.174.242.1895Domain Naming System (DNS)Until 1988 Internet mapping between host names and IP addresses was maintained manually in a single text file – HOSTS.TXTCurrently, the mapping has been maintained in a distributed world-wide database known as DNSConceptually, DNS database consists of millions of host entry structures (of type ‘hostent’)6IP AddressIP addresses are specified- binary in network byte order in s_addr field of structin_addr- human readable form – dotted-decimal notation or Internet address dot notation129.115.30.129 (IP address of usp.cs.utsa.edu)IPv4 address – 32 bits (4Bytes long)IPv6 address – 128 bits (16Bytes long)in_addr_t inet_addr(const char *cp) - Function converts a dotted-decimal notation address to binary in network byte orderchar *inet_ntoa(const struct in_addr_in)- Function converts binary form into dotted-decimal notation7Conversion of Host Name to IP AddressTraditional way of converting host name to a binary address is#include <netdb.h>struct hostent *gethostbyname(const char *name)struct hostent {char *h_name; /*canonical name of host */char ** h_aliases; /*alias list */int h_addrtype; /* host address type*/int h_length; /*length of address */char **h_addr_list; /*list of addresses */};8Examplechar *hostn = “usp.cs.utsa.edu”;struct hostent *hp;struct sockaddr_in server; if ((hp = gethostbyname(hostn)) == NULLfprintf(stderr, “Failed to resolve host name \n”);elsememcpy((char *)&server.sin_addr.s_add,hp->h_addr_list[0], hp->h_length);Internet application retrieves host entry from the DNS database associated with the domain name “hostn”9Conversion from Address to name #include <netdb.h>struct hostent *gethostbyaddr (const void *addr,socklen_t len, int type); For IPv4 – type = AF_INETInternet Application retrieves host entry associated with the IP address “addr”.10Examplestruct hostent *hp;struct sockaddr_in net;int sock; if ((hp=gethostbyaddr(&net.sin_addr, 4,AF_NET))printf(“Host name is %s\n”, hp->h_name);11Another approach to Conversion Use new POSIX standard 2001 1. getnameinfo (instead of gethostbyname)2. getaddrinfo (instead of gethostbyaddr)These routines do not use static dataThese functions are safe to use in a threaded environmentProblem: not available on many systems12TCP/IP Application – Electronic Mail Simple Mail Transfer Protocol (SMTP)Standard X.400 Mail User Agent/SMTPTCP/IPMAC/PHYMail Server/SMTPTCP/IPMAC/PHYMailboxMail User Agent/SMTPTCP/IPMAC/PHYWAN(Wide Area Network)LAN(Local Area Network)13TCP/IP Application – File TransferFTP – File Transfer Protocol – sends files from one system to another under user command (‘sftp’ currently)FTP/RequesterTCP/IPMAC/PHYFTP File ServerTCP/IPMAC/PHYNetworkRequesterServerOpen First TCP Connection for Control(Exchange user ID/PasswordAnd Approve Transfer)Open Second TCP Connection for Data Transfer14TCP Application - TelnetTelnet – remote login capability which enables a user at a PC to login to a remote computer and function as if directly connected to that computer (‘ssh’ currently)Telnet UserTCP/IPMAC/PHYTelnet ServerTCP/IPMAC/PHYNetwork15TCP Application – World Wide WebOrigin of WWW – 1989 WWW invented by Tim Berners-Lee - software engineer working at CERN – Swiss Physics Laboratory1993 – Marc Andreesen and his colleagues at NCSA UIUC released a graphical browser, called MOSAIC for all three major platforms: UNIX, Windows, MacintoshAfter release of MOSAIC, interest in Web exploded 2007 – 113,658,468 Web sites (according to www.netcraft.com)16Web Markup Language - HTMLWhat distinguishes Web services from conventional file retrieval such as FTP? Main difference: Web content can be written in language – HTML (Hypertext Markup Language)HTML Program – contains tags to tell the browser how to display text and graphic objects<b> Make me bold! </b>Real Power of HTMP – Pointers – Hyperlinks<a href=“http://www.cs.uiuc.edu/index.html”> CS Department at UIUC </a>17Web Content (1)Conent is a sequence of bytes with an associated MIME type (Multipurpose Internet Mail Extensions) Text/html (HTML page)Text/plain (unformatted text)Application/postscript (postscript document)Image/gif (Binary image encoded in GIF Format)Image/jpeg (Binary image encoded in JPEG Format)18Web Content (2)Web servers provide content to clients:1. Fetch a disk file – static content – serving static content2. Run executable file and return output to client -dynamic content – serving dynamic outputEach file has a unique name known as URL (Universal Resource Locator)http://www.aol.com:80/index.htmlPort 80 is a default to well-known HTTP port.19HTTP Web ProtocolWeb Client and Web Servers interact using a text-based


View Full Document

U of I CS 241 - System Programming

Documents in this Course
Process

Process

28 pages

Files

Files

37 pages

File I/O

File I/O

52 pages

C Basics

C Basics

69 pages

Memory

Memory

23 pages

Threads

Threads

14 pages

Lecture

Lecture

55 pages

C Basics

C Basics

24 pages

Signals

Signals

27 pages

Memory

Memory

45 pages

Threads

Threads

47 pages

Threads

Threads

28 pages

LECTURE

LECTURE

45 pages

Threads

Threads

30 pages

Threads

Threads

55 pages

Files

Files

37 pages

SIGNALS

SIGNALS

22 pages

Files

Files

37 pages

Threads

Threads

14 pages

Threads

Threads

13 pages

Load more
Download System Programming
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 System Programming 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 System Programming 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?