class26 - 15-213 The course that gives CMU its Zip! Network...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
Network Programming Nov 21, 2002 Topics Topics Programmer’s view of the Internet (review) Sockets interface Writing clients and servers class26.ppt 15-213 “The course that gives CMU its Zip!”
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
– 2 – 15-213, F’02 A Client-Server Transaction Client process Server process 1. Client sends request 2. Server handles request 3. Server sends response 4. Client handles response Resource Every network application is based on the client-server Every network application is based on the client-server model: model: A server process and one or more client processes Server manages some resource . Server provides service by manipulating resource for clients. Note: clients and servers are processes running on hosts (can be the same or different hosts).
Background image of page 2
– 3 – 15-213, F’02 A Programmer’s View of the Internet 1. Hosts are mapped to a set of 32-bit 1. Hosts are mapped to a set of 32-bit IP addresses IP addresses . 128.2.203.179 2. The set of IP addresses is mapped to a set of 2. The set of IP addresses is mapped to a set of identifiers called Internet identifiers called Internet domain names domain names . 128.2.203.179 is mapped to www.cs.cmu.edu 3. A process on one Internet host can communicate 3. A process on one Internet host can communicate with a process on another Internet host over a with a process on another Internet host over a connection connection .
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
– 4 – 15-213, F’02 1. IP Addresses 32-bit IP addresses are stored in an 32-bit IP addresses are stored in an IP address struct IP address struct IP addresses are always stored in memory in network byte order (big-endian byte order) True in general for any integer transferred in a packet header from one machine to another. E.g., the port number used to identify an Internet connection. /* Internet address structure */ struct in_addr { unsigned int s_addr; /* network byte order (big-endian) */ }; Handy network byte-order conversion functions: htonl: convert long int from host to network byte order. htons: convert short int from host to network byte order. ntohl: convert long int from network to host byte order. ntohs: convert short int from network to host byte order.
Background image of page 4
– 5 – 15-213, F’02 2. Domain Naming System (DNS) The Internet maintains a mapping between IP addresses The Internet maintains a mapping between IP addresses and domain names in a huge worldwide distributed and domain names in a huge worldwide distributed database called database called DNS DNS . Conceptually, programmers can view the DNS database as a collection of millions of host entry structures : Functions for retrieving host entries from DNS: Functions for retrieving host entries from DNS: gethostbyname : query key is a DNS domain name. gethostbyaddr:
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 37

class26 - 15-213 The course that gives CMU its Zip! Network...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online