Week 01_2 Internet & Web Programming PDF

Document Details

StatelyDandelion

Uploaded by StatelyDandelion

Heriot-Watt University

Md Azher Uddin

Tags

internet protocols networking web programming computer networks

Summary

This document presents lecture notes on various concepts of internet and web programming, including fundamental protocols like TCP/IP, and the role of different layers like application, transport, network, and link layers. It defines important terms such as sockets, ports, and discusses protocols like UDP and TCP and their differences.

Full Transcript

F28WP Web Programming INTERNET & WEB Md Azher Uddin [email protected] HOW DOES THE INTERNET WORK? Worldwide set of agreed common standards (e.g., TCP/IP) Internet is able to connect computer networks across the world (worldweb) Exchange data and information WHAT IS THE WORLD WI...

F28WP Web Programming INTERNET & WEB Md Azher Uddin [email protected] HOW DOES THE INTERNET WORK? Worldwide set of agreed common standards (e.g., TCP/IP) Internet is able to connect computer networks across the world (worldweb) Exchange data and information WHAT IS THE WORLD WIDE WEB? World Wide Web (WWW) is global scale, distributed hyper media application with Client Server architecture Resources are transferred using Uniform Resource Identifiers (URI) and HyperText Transfer Protocol (HTTP) WWW clients and browsers (agreed/supported communication standards/software systems) NATURE OF THE INTERNET Connect and Communicate Internet is an internetwork of Wide Area Networks with gateways between them based upon common use of TCP/IP protocols supporting standard application services (DNS, e-mail, web) Internet has no central operations room or global operations manager Each Internet host has an IP address e.g. 137.195.13.48 Some Internet hosts have a domain name e.g. www.macs.hw.ac.uk Who regulates the internet? IETF, ICANN and ISOC Internet Engineering Task Force (IETF) Internet Corporation for Assigned Names and Numbers or ICANN Internet Society (ISOC) HOW ARE THE TCP/IP NETWORKS STRUCTURED? TCP/IP NETWORKS CAN BE VIEWED AS 4 LAYER STRUCTURE LAYER FUNCTIONALITY Application interfaces directly with user applications or users Transport end to end (un)reliable delivery of TCP (Transmission Control Protocol) or UDP (User Datagram Protocol) packets Network IP datagram delivery, addressing, routing Link delivers frames, handles errors, drives physical transfers Networking Layers o Physical Layer: to provide a physical connection between networked computers, or hosts. A physical medium is necessary for the transmission of information. o Link Layer: to provide a method of communication between physically connected hosts which a source host can package up information and transmit it through the physical layer, such that the intended destination host has a sporting chance of receiving the package and extracting the desired information. Networking Layers o Network Layer: The network layer’s duty is to provide a logical address infrastructure on top of the link layer, such that host hardware can easily be replaced, groups of hosts can be segregated into subnetworks, and hosts on distant subnetworks, using different link layer protocols and different physical media can send messages to each other. IPv4: defining a logical addressing system to name each host individually, a subnet system for defining logical subsections of the address space as physical subnetworks, and a routing system for forwarding data between subnets. An IPv4 IP address is a 32-bit number, usually displayed to humans as four 8-bit numbers separated with periods and it allows for 4 billion unique IP addresses A subnet mask is a 32-bit number, usually written in the four-number, dotted notation typical of IP addresses. Hosts are said to be on the same subnet if their IP addresses, when bitwise ANDed with the subnet mask, yield the same result. Networking Layers o Transport Layer: While the network layer’s job is to facilitate communication between distant hosts on remote networks, the transport layer’s job is to enable communication between individual processes on those hosts. A port is a 16-bit, unsigned number representing a communication endpoint at a particular host. Ports 0 to 1023 are known as the system ports or reserved ports. Ports 49152 to 65535 are known as dynamic ports. Networking Layers A socket is one endpoint of a two-way communication link between two programs running on the network. A socket is bound to a port number so that the TCP layer can identify the application that data is destined to be sent to. Socket Port The word “Socket” is the combination The word “Port” is the number used of port and IP address. by particular software. The same port number can be used It is used to identify both a machine in different computer running on and a service within the machine. same software. Networking Layers User datagram protocol (UDP) is a lightweight protocol for wrapping data and sending it from a port on one host to a port on another host. A UDP datagram consists of an 8-byte header followed by the payload data. ◦Source port (16 bits) identifies the port from which the datagram originated. This is useful if the recipient of the datagram wishes to respond. ◦Destination port (16 bits) is the target port of the datagram. The UDP module delivers the datagram to whichever process has bound this port. ◦Length (16 bits) is the length of the UDP header and payload. ◦Checksum (16 bits) is an optional checksum calculated based on the UDP header, payload, and certain fields of the IP header. If not calculated, this field is all zeroes. Often this field is ignored because lower layers validate the data. Networking Layers Transmission control protocol (TCP) enables the creation of a persistent connection between two hosts followed by the reliable transfer of a stream of data. The structure of TCP is: ◦Source port (16 bits) and destination port (16 bits) are transport layer port numbers. ◦Sequence number (32-bits) is a monotonically increasing identifier so the sender can label data being sent and the recipient can acknowledge it. ◦Acknowledgment number (32-bits) contains the sequence number of the next byte of data that the sender is expecting to receive which acts as a de facto acknowledgment for all data with sequence numbers lower than this number ◦Data offset (4 bits) specifies the length of the header in 32-bit words for optional header elements at the end of its header, so there can be from 20 to 64 bytes between the start of the header and the data of the segment. ◦Control bits (9 bits) hold metadata about the header. ◦Receive window (16 bits) conveys the maximum amount of remaining buffer space the sender has for incoming data. This is useful for maintaining flow control, as discussed later. ◦Urgent pointer (16 bits) holds the delta between the first byte of data in this segment and the first byte of urgent data. This is only relevant if the URG flag is set in the control bits. Networking Layers - TCP Sockets UDP and TCP Connection-oriented & connectionless datagram socket A socket programming construct can make use of either the UDP or TCP protocol. o Sockets that use UDP for transport are known as datagram sockets o Sockets that use TCP are termed stream sockets. TCP and UDP play the same role, but do it differently o Both receive transport protocol packets and pass along their contents to the Presentation Layer. o TCP divides messages into packets and reassembles them in the correct sequence at the receiving end. o It also handles requesting retransmission of missing packets. o With TCP, the upper-level layers have much less to worry about. o UDP doesn't provide assembly and retransmission requesting features. o It simply passes packets along. o The upper layers have to make sure that the message is complete and assembled in correct sequence. TCP OR UDP? TCP UDP TCP is connection-oriented, meaning it UDP is connectionless, meaning it does establishes a reliable, full-duplex not establish a connection before sending connection between the sender and data. Each UDP packet is independent. receiver before data exchange begins. TCP provides reliability through UDP does not provide reliability or error- mechanisms such as error-checking, error- checking mechanisms. correction, acknowledgments, and retransmission of lost packets. TCP headers are larger due to control UDP headers are small, resulting in lower information, resulting in higher overhead. overhead compared to TCP. Use TCP when data integrity, Use UDP when low latency and reliability, and ordered delivery real-time communication are are critical. more important than Use TCP for file transfers, web reliability. browsing, email, database transactions, Use UDP for applications like online and similar applications. gaming (for low-level data transmission), live video streaming, VoIP, and multimedia Networking Layers o Application Layer: home to many fundamental protocols of the Internet that rely on the transport layer for end-to-end communication : o DHCP: allowing a host to request configuration information automatically when it attaches to the network o DNS: enables the translation of domain and subdomain names into IP addresses. DNS queries and responses are usually sent via UDP on port 53. EXAMPLES OF PROTOCOLS (INTERNET LAYERS) Application SMTP, IMAP, HTTP, DNS, RTP, SNMP, TFTP Transport TCP, UDP, SCTP Network IP, ICMP, IPsec, IGMP Link Ethernet, 802.11, DSL, ARP, L2TP, ISDN, GPRS, PPP TCP carries reliable services - email (SMTP, IMAP), web (HTTP) UDP carries best efforts services - DNS, media streams (RTP)

Use Quizgecko on...
Browser
Browser