• No results found

lec-14 (TCP , UDP)

N/A
N/A
Protected

Academic year: 2020

Share "lec-14 (TCP , UDP)"

Copied!
26
0
0

Loading.... (view fulltext now)

Full text

(1)

Lecture # 14

TCP/IP

Computer Communication & Networks

Fall-2012

(2)

Today’s Menu

↗ Transmission Control Protocol ↗ Addressing (Port Numbers) ↗ Datagram Format

(3)

Transmission Control Protocol

Functions Performed by TCP

↗ Addressing

↗ Connection Establishment, Management and Termination

↗ Reliability and Transmission Quality Services

(4)

Transmission Control Protocol

Addressing

↗ A typical host on a TCP/IP internetwork has many different software application processes running concurrently

↗ Each generates data that it sends to either TCP or UDP, which in turn passes it to IP for transmission

↗ The question is: how do we demultiplex a sequence of IP datagrams that need to go to many different application processes?

↗ Let's consider a particular host with a single network interface bearing the IP address 10.10.10.10

↗ Normally, every datagram received by the IP layer will have this value in the IP Destination Address field

↗ Consecutive datagrams received by IP may contains a piece of a file you are downloading with your Web browser, an e-mail sent to you by your brother, and a line of text a buddy wrote in an IRC chat channel

(5)
(6)
(7)

Transmission Control Protocol

Addressing

↗ TCP and UDP port numbers are 16 bits in length, so valid port numbers can theoretically take on values from 0 to 65,535

↗ These are divided into ranges for different purposes, with certain ports reserved for particular uses

(8)

Transmission Control Protocol

The Problem: Identifying Particular Processes on a Server

↗ We fire up our Web browser, which is client software that sends requests using the Hypertext Transfer Protocol (HTTP)

↗ We need to know the IP address (domain name) of the Web site we want to access

↗ Once we have the address, the Web browser can generate an HTTP message and send it to the Web site's IP address.

↗ This HTTP message is being sent not “just anywhere” on that IP address: it is intended for the Web server process on the site we are trying to reach

↗ The problem is: how does the Web browser (client process) know which port number has been assigned to the server process on the Web site?

(9)

Transmission Control Protocol

The Solution: Reserved Port Numbers

↗ TCP/IP reserves certain port numbers for particular applications

↗ Each common application has a specific port number that is assigned to it for use by server processes that listen for requests for that application and then respond to them

↗ In our example, the reserved port number for HTTP is 80

↗ Every Web browser just “knows” that Web sites are designed to listen for requests sent to port 80

↗ They will thus use this value in requests, to ensure the IP and TCP software on the Web browser direct these HTTP messages to the Web server software

(10)

Transmission Control Protocol

↗ For this system to work well, universal agreement on port assignments is essential

↗ For TCP/IP, it is the same authority responsible for the assignment and coordination of IP addresses, the Internet Assigned Numbers Authority (IANA) ↗ As we have seen, there are 65,536 port numbers that can be used for processes,

the full spectrum of TCP and UDP port numbers is divided into three ranges

Well-Known Port Numbers (0 to 1,023)Registered Port Numbers (1,024 to 49,151)

(11)

Transmission Control Protocol

↗ Well-Known Port Numbers (0 to 1,023)

↗ These port numbers are used only by server processes run by system administrators or privileged users

↗ These generally correspond to processes that implement key IP applications, such as Web servers, FTP servers and the like

↗ For this reason, these are sometimes called system port numbers

↗ Registered Port Numbers (1,024 to 49,151)

↗ There are many applications that need to use TCP/IP but are not specified in RFCs, or are not so universally used

↗ To ensure that these various applications do not conflict with each other, IANA uses the bulk of the overall port number range for registered port numbers

↗ Anyone who creates a viable TCP/IP server application can request to reserve one of these port numbers

↗ These port numbers are generally accessible by any user on a system and are therefore sometimes called user port numbers

↗ Private/Dynamic Port Numbers (49,152 to 65,535)

↗ These ports are neither reserved nor maintained by IANA

(12)

Transmission Control Protocol

(13)

Transmission Control Protocol

Source Port (16 bits)

↗ The port number of the process that originated the TCP segment on the source device

↗ This will normally be an client port number for a request sent by a client to a server, or a well-known/registered (server) port number for a reply from a server to a client

Destination Port (16 bits)

↗ The 16-bit port number of the process that is the ultimate intended recipient of the message on the destination device

(14)

Transmission Control Protocol

Sequence Number (32 bits)

↗ For normal transmissions, the sequence number of the first byte of data in this segment

↗ In a connection request (SYN) message, this carries the initial sequence number (ISN) of the source TCP

Acknowledgment Number (32 bits)

(15)

Transmission Control Protocol

Header Length (4 bits)

↗ Specifies the number of 32-bit words in the TCP header

↗ In other words, this value times four equals the number of bytes in the header, which must always be a multiple of four

↗ It is also called a “data offset” since it indicates by how many 32-bit words the start of the data is offset from the beginning of the TCP segment

Reserved (6 bits)

(16)

Transmission Control Protocol

Control Bits or Flags (6 bits)

URG: (Urgent Bit) When set to 1, indicates that the priority data transfer has been invoked for this segment and that the urgent pointer field is valid

ACK: (Acknowledgment Bit) When set to 1, indicates that this segment is carrying an acknowledgment and the value of the acknowledgment number field is valid and carrying the next sequence expected from the destination of this segment ↗ PSH: (Push Bit) The sender of this segment is using the TCP push feature,

requesting that the data in this segment be immediately pushed to the application on the receiving device

RST: (Reset Bit) The sender has encountered a problem and wants to reset the connection

SYN: (Synchronize Bit) This segment is a request to synchronize sequence numbers and establish a connection; the sequence number field contains the initial sequence number of the sender of the segment

(17)

Transmission Control Protocol

Window (16 bits)

↗ Indicates the number of octets of data the sender of this segment is willing to accept from the receiver at one time

↗ This normally corresponds to the current size of the buffer allocated to accept data for this connection

↗ This field is, in other words, the current receive window size for the device sending this segment, which is also the send window for the recipient of the segment

Checksum (16 bits)

↗ A checksum for data integrity protection, computed over the entire TCP datagram

(18)

Transmission Control Protocol

Urgent Pointer (16 bits)

↗ Used in conjunction with the URG control bit for priority data transfer ↗ This field contains the sequence number of the last byte of urgent data

Options and Padding (Variable)

↗ TCP includes a generic mechanism for including one or more sets of optional data in a TCP segment

↗ If the Options field is not a multiple of 32 bits in length, enough zeroes are added to pad the header so it is a multiple of 32 bits

Data (Variable)

(19)

User Datagram Protocol

↗ UDP is simple and fast

↗ It serves as an interface between application processes running at the higher layers and the internetworking capabilities of IP

↗ UDP is a fast protocol specifically because it doesn't have all the bells and whistles of TCP

↗ This makes it suitable for use by some applications because this is exactly what they want from a transport layer protocol.

↗ It takes their data and quickly shuffles it down to the IP layer with a minimum of fuss

(20)

User Datagram Protocol

What UDP Does Not

As a transport protocol, some of the most important things UDP does not do include the following:

↗ UDP does not establish connections before sending data; It just packages it and off it goes

↗ UDP does not provide acknowledgments to show that data was received ↗ UDP does not provide any guarantees that its messages will arrive

↗ UDP does not detect lost messages and retransmit them

↗ UDP does not ensure that data is received in the same order that they were sent ↗ UDP does not provide any mechanism to manage the flow of data between

(21)

User Datagram Protocol

Datagram format

(22)

User Datagram Protocol

Source Port (16 bits)

↗ The 16-bit port number of the process that originated the UDP message on the source device

↗ This will normally be an client port number for a request sent by a client to a server, or a well-known/registered (server) port number for a reply from a server to a client

Destination Port (16 bits)

↗ The 16-bit port number of the process that is the ultimate intended recipient of the message on the destination device

(23)

User Datagram Protocol

Length (16 bits)

The length of the entire UDP datagram, including both header and Data fields

Checksum (16 bits)

An optional checksum computed over the entire UDP datagram

Data (variable)

(24)

Summary Comparison of UDP & TCP

UDP

General Description

Simple, high-speed, low-functionality “wrapper” that interfaces applications to the network layer and does little else

Protocol Connection Setup

Connectionless; data is sent without setup

Data Interface To Application

Message-based; data is sent in discrete packages by the application

Reliability and Acknowledgments

Unreliable, best-effort delivery without acknowledgments

TCP

General Description

Full-featured protocol that allows applications to send data reliably without worrying about network layer issues

Protocol Connection Setup

Connection-oriented; connection must be established prior to transmission

Data Interface To Application

Stream-based; data is sent by the application with no particular structure

Reliability and Acknowledgments

(25)

Summary Comparison of UDP & TCP

UDP

Retransmissions

Not performed; Application must detect lost data and retransmit if needed

Features Provided to Manage Flow of Data None Overhead Very low Transmission Speed Very high TCP Retransmissions

Delivery of all data is managed, and lost data is retransmitted automatically

Features Provided to Manage Flow of Data Flow control using sliding windows; window size adjustment heuristics; congestion avoidance algorithms

Overhead

Low, but higher than UDP

Transmission Speed

(26)

Summary Comparison of UDP & TCP

UDP

Types of Applications That Use The Protocol Applications where data delivery speed matters more than completeness, where small amounts of data are sent; or where multicast/ broadcast are used

Well-Known Applications and Protocols

Multimedia applications, DNS, BOOTP, DHCP, TFTP, SNMP, RIP

TCP

Types of Applications That Use The Protocol Most protocols and applications sending data that must be received reliably, including most file and message transfer protocols

Well-Known Applications and Protocols

References

Related documents

They observed that the expression levels decrease from nevi to stage III/IV melanoma samples and also that melanoma cell lines resistant to BRAF/ MEK inhibitors showed a

Based on the audit procedures performed, the Office of Internal Audits (Internal Audits) concludes that the College of Natural Sciences (CNS) information technology..

Therefore, this study is aimed at proposing a multi-objective model for resource-constrained project scheduling problem, with the model objectives being to minimize

Methods: The agar well diffusion and agar dilution methods were used for determining inhibition zone diameter and minimum inhibitory concentration during preliminary evaluation

Al-Hazemi (2000) suggested that vocabulary is more vulnerable to attrition than grammar in advanced L2 learners who had acquired the language in a natural setting and similar

The present study tries to shed lights behind the complexity of the relationship between income and subjective well-being (SWB) by bringing into the analysis some alternative

Pension standards legislation generally protects benefits accrued up to a certain date, that is benefits that have been accumulated based on current salary and service. However, a

The purpose of this study is to identify the impact of the principles and practices of quality management based on customer satisfaction, continuous improvement, and supplier