23
World-Wide Web

World-Wide Web. The Internet Asia Pacific - Red Europe/Middle East/Central Asia/Africa - Green North America - Blue Latin American and Caribbean - Yellow

Embed Size (px)

Citation preview

Page 1: World-Wide Web. The Internet Asia Pacific - Red Europe/Middle East/Central Asia/Africa - Green North America - Blue Latin American and Caribbean - Yellow

World-Wide Web

Page 2: World-Wide Web. The Internet Asia Pacific - Red Europe/Middle East/Central Asia/Africa - Green North America - Blue Latin American and Caribbean - Yellow

The Internet

Asia Pacific - RedEurope/Middle East/Central Asia/Africa - GreenNorth America - BlueLatin American and Caribbean - YellowRFC1918 IP Addresses - CyanUnknown - White

Page 3: World-Wide Web. The Internet Asia Pacific - Red Europe/Middle East/Central Asia/Africa - Green North America - Blue Latin American and Caribbean - Yellow

ISO/OSI Protocol Stack Model

Page 4: World-Wide Web. The Internet Asia Pacific - Red Europe/Middle East/Central Asia/Africa - Green North America - Blue Latin American and Caribbean - Yellow

1 Application layer: provides a means for the user to access information on the network through an application. Functions typically include identifying communication partners, and determining availability of required resources.

Some examples of application layer implementations include Telnet, File Transfer Protocol (FTP), and Simple Mail Transfer Protocol (SMTP).

Page 5: World-Wide Web. The Internet Asia Pacific - Red Europe/Middle East/Central Asia/Africa - Green North America - Blue Latin American and Caribbean - Yellow

2 Presentation layer: converts local host computer data representations to/from a standard network format for transmission on the network.

Examples of Presentation layer coding and conversion schemes include data representation formats, conversion of character formats, compression, and encryption schemes.

3. Session layer: establishes, manages, and terminates communication sessions, such as for RPC. Communication sessions consist of service requests and service responses that occur among applications located on different network devices.

Page 6: World-Wide Web. The Internet Asia Pacific - Red Europe/Middle East/Central Asia/Africa - Green North America - Blue Latin American and Caribbean - Yellow

4.Transport layer: Is responsible for providing reliable service between the hosts. Upper layer datagrams are broken down into manageable datagrams and then appropriate header information (such as sequence number, port number, etc.) are added to the datagram before passing it on to the Network layer. Two transport protocols are the TCP (Transmission Control Protocol) and the UDP (User Datagram Protocol).

5. Network layer: Is responsible for the routing of packets through the entire network. Note that the physical address (like MAC address) keeps changing from hop to hop when a packet travels from source to destination. As a result, an address that doesn't change is required to ensure continuity between hops. For the Internet, IP address is the logical address.

Page 7: World-Wide Web. The Internet Asia Pacific - Red Europe/Middle East/Central Asia/Africa - Green North America - Blue Latin American and Caribbean - Yellow

6. Data link layer: Provides delivery of frames between devices. Is responsible for flow regulation, error detection and correction, framing of bits for transmission. The network frame is made up of checksum, destination MAC address, source address, and the data. The largest frame size is the maximum transmission Unit (MTU). Consists of two sub layers: 1.Logical Link Control (LLC): Defines how data is

transferred over the media and provides data link service to the higher layers.

2.Medium Access Control (MAC): Controls media access by regulating the communicating nodes using pre-defined set of rules. (i.e. Token passing, Ethernet [CSMA/CD]).

7. Physical layer: Handles the bit-level communications across the physical medium. The physical medium could be made up of wired electrical signals, or light, or radio (wireless) signals.

Page 8: World-Wide Web. The Internet Asia Pacific - Red Europe/Middle East/Central Asia/Africa - Green North America - Blue Latin American and Caribbean - Yellow

TCP/IP InternetArchitecture

Page 9: World-Wide Web. The Internet Asia Pacific - Red Europe/Middle East/Central Asia/Africa - Green North America - Blue Latin American and Caribbean - Yellow

Domain Name Service

Page 10: World-Wide Web. The Internet Asia Pacific - Red Europe/Middle East/Central Asia/Africa - Green North America - Blue Latin American and Caribbean - Yellow

HTTP -- port 80CLIENT

GET /pub/WWW/TheProject.html HTTP/1.1 Host: www.w3.org

SERVER -- replies w Content-Type….MIME (Multipurpose Internet Mail Extensions)

application/vnd.ms-powerpoint application/x.javascriptaudio/tone image/jpeg image/vnd.wap.wbmp message/news model/vrml text/tab-separated-values text/html video/quicktime

Page 11: World-Wide Web. The Internet Asia Pacific - Red Europe/Middle East/Central Asia/Africa - Green North America - Blue Latin American and Caribbean - Yellow

Be a Browser

telnet uga.edu 80Type everything below as shown:

GET /index.html HTTP/1.1 Host: www.uga.eduConnection: close

CR/LF

CR/LF

Page 12: World-Wide Web. The Internet Asia Pacific - Red Europe/Middle East/Central Asia/Africa - Green North America - Blue Latin American and Caribbean - Yellow

TCP Packet

Page 13: World-Wide Web. The Internet Asia Pacific - Red Europe/Middle East/Central Asia/Africa - Green North America - Blue Latin American and Caribbean - Yellow

IP Addresses (32-bits)

IP Network Classes

Network Type Address Range Normal MaskClass A 001.x.x.x to 126.x.x.x 255.0.0.0Class B 128.1.x.x to 191.254.x.x 255.255.0.0Class C 192.0.1.x to 223.255.254.x 255.255.255.0 Class D 224.x.x.x to 239.255.255.255Class E 240.x.x.x to 247.255.255.255

Page 14: World-Wide Web. The Internet Asia Pacific - Red Europe/Middle East/Central Asia/Africa - Green North America - Blue Latin American and Caribbean - Yellow

IP Packet

Page 15: World-Wide Web. The Internet Asia Pacific - Red Europe/Middle East/Central Asia/Africa - Green North America - Blue Latin American and Caribbean - Yellow

EtherNet Packet

Page 16: World-Wide Web. The Internet Asia Pacific - Red Europe/Middle East/Central Asia/Africa - Green North America - Blue Latin American and Caribbean - Yellow

Universal Resource Identifier

<scheme>://<net_location>/<path>; <arguments>?<query>#<fragment>

http://www.google.com/search?hl=en& ie=UTF-8&oe=UTF-8&q=usatoday+lincoln

Page 17: World-Wide Web. The Internet Asia Pacific - Red Europe/Middle East/Central Asia/Africa - Green North America - Blue Latin American and Caribbean - Yellow

Berkeley Socket API

De facto standard for communications programming.

Socket - end point for communications.  They are file descriptors.  Thus we can use system calls like read and write to receive and send data.

To communicate with a program on another computer, we have to identify the computer and specify the program. Specify the computer by giving its IP address.  Specify the program with its port number, which is a positive integer that is advertised by the program that is waiting for a connection.

Page 18: World-Wide Web. The Internet Asia Pacific - Red Europe/Middle East/Central Asia/Africa - Green North America - Blue Latin American and Caribbean - Yellow

#include <unistd.h>#include <netdb.h>int gethostname(char name[], size_t namelen);int sethostname(const char name[], int namelen);struct hostent *gethostbyname(const char name[]);char *inet_ntoa(struct in_addr in);in_addr_t inet_addr(const char *cp);

h=gethostbyname("ibm.com");memcpy(&a, h->h_addr_list[0], sizeof(struct

in_addr));printf("%s\n", inet_ntoa(a));printf("0x%0lx\n", inet_addr("129.42.19.99"));

OUTPUT129.42.16.1030x63132a81

Page 19: World-Wide Web. The Internet Asia Pacific - Red Europe/Middle East/Central Asia/Africa - Green North America - Blue Latin American and Caribbean - Yellow
Page 20: World-Wide Web. The Internet Asia Pacific - Red Europe/Middle East/Central Asia/Africa - Green North America - Blue Latin American and Caribbean - Yellow

Socket TCP/IP API#include <sys/types.h>#include <sys/socket.h>int socket(int protocolFamily, int rawDatagramStream, int protocol);int bind(int socket, const struct sockaddr *address, socklen_t

address_len);int listen(int socket, int maxQueueLength);int accept(int socket, struct sockaddr *restrict address, socklen_t

*restrict address_len);ssize_t recv(int socket, void *buffer, size_t length, int flags);int connect(int socket, const struct sockaddr *address, socklen_t

address_len);ssize_t send(int socket, const void *buffer, size_t length, int flags);//select blocks on multiple ports until one completes an I/Oint select(int nfds, fd_set *restrict readfds, fd_set *restrict writefds, fd_set *restrict errorfds, struct timeval *restrict timeout);uint16_t htons(uint16_t hostshort); //cvt host to network byte orderuint32_t ntohl(uint32_t netlong); //network to host byte order

Page 21: World-Wide Web. The Internet Asia Pacific - Red Europe/Middle East/Central Asia/Africa - Green North America - Blue Latin American and Caribbean - Yellow

#include <stdio.h>#include <string.h>#include <netdb.h>#include <sys/types.h>#include <sys/socket.h>

int main(int argc, char *argv[]) { int i; char str[1024]; char msg[] = "GET / HTTP/1.0\r\nHost:

www.uga.edu\r\nConnection: close\r\n\r\n"; int s; struct sockaddr_in si; struct hostent *h = gethostbyname(uga.edu"); s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);

Get a web page

using the socket API

Page 22: World-Wide Web. The Internet Asia Pacific - Red Europe/Middle East/Central Asia/Africa - Green North America - Blue Latin American and Caribbean - Yellow

memset(&si, 0, sizeof(si));memcpy(&si.sin_addr, h->h_addr_list[0], sizeof(struct in_addr)); si.sin_port = htons(80);si.sin_family = AF_INET;i = connect(s, (const struct sockaddr *)&si, sizeof(si));i = send(s,msg, sizeof(msg), 0);i = recv(s, str, sizeof(str), 0);if (i > 0) { str[i] = 0; printf("%s\n", str);}close(s);

}

Page 23: World-Wide Web. The Internet Asia Pacific - Red Europe/Middle East/Central Asia/Africa - Green North America - Blue Latin American and Caribbean - Yellow

Cookies

Variables for a distributed computationProperty Lists

.tucows.com TRUE / FALSE 2145801589 NGUserID cf88422c-26266-958947479-5

207.136.66.80 FALSE / FALSE 1116627479 Apache 192.9.25.22.18775958947478702