Download presentation
Presentation is loading. Please wait.
1
Transport Layer Transport Services Addressing Internet Transport Protocols TCP (Transmission Control Protocol) and UDP (User Datagram Protocol) Introduction to UDP (Operation of UDP, Characteristics of UDP, Application of UDP) Introduction to TCP (Operation of TCP, Characteristics of TCP, TCP three-way handshake process, Application of TCP) Relationship between TCP & IP Standard TCP / IP services Port numbers and socket address Overview of BSD Socket API By: Er. Bednidhi Rijal
2
Transport Service The transport service are of two types:
Connection Oriented Service Connectionless Service Provides reliable service Acknowledge facility is incorporated TCP (Transmission control protocol) is used for this purpose Connection-oriented communication includes the following steps Connection Establishment: The source and destination machine establishes a connection before any data is transferred. Connection is established by having both sides initialize variables and counters Data Transfer: In this phase, the frames are actually transmitted Connection Release: In this phase, the connection is released. The buffers and other variable to maintain connection are freed up. By: Er. Bednidhi Rijal
3
Contd.. Connectionless Packets are sent from one party to another with no need for connection establishment or connection release Packets are not numbered; they may be delayed or lost or may arrive out of sequence. (I.e. Provides unreliable service) No acknowledge facility is incorporated UDP (User datagram protocol) is used for this purpose By: Er. Bednidhi Rijal
4
Quality of Service The transport layer provides certain Quality of service (QOS) It denotes a set of parameters which collectively describe the quality of the transport service requested by the user which are explained below: Connection Establishment Delay The time difference between the instant at which the transport connection is requested and the instant at which it is confirmed is called connection Establishment Delay Shorter the delay, better is the service Connection Establishment Failure Probability This is the probability that connection is not established even after maximum delay This may be due to network congestion Throughput It measures the number of bytes a user transfers per second, over a time interval By: Er. Bednidhi Rijal
5
Contd.. Transit Delay Residual error ratio Protection
It is the time delay between a message sent by the transport layer source machine and the message being received by the destination machine's transport layer Residual error ratio It measures the number of lost or garbled message as a function of the total message sent Ideally the ratio should be zero, and practically it should be as small as possible. Protection This parameter protects the transmitted data from being read or modified by unauthorized parties By: Er. Bednidhi Rijal
6
Contd.. Priority Resilience
This parameter provides a way for the users to show that some its connection is more important (higher priority) than the others. This is important while handling data on congestion Higher priority connection gets service before low priority connection Resilience Due to internal problem or congestion, the transport layer spontaneously terminates connection The resilience parameter gives the probability of such termination By: Er. Bednidhi Rijal
7
Addressing At the transport layer, Port number is used as a transport layer address to choose among multiple processes running on the destination host. The destination port number is needed for delivery; the source port number is needed for the reply. In the Internet model, the port numbers are 16-bit integers between 0 and 65,535. The client program defines itself with a port number, chosen randomly by the transport layer software running on the client host. This is the ephemeral port number or temporary. By: Er. Bednidhi Rijal
8
Contd.. The server process must also define itself with a port number but it cannot be chosen randomly, instead it uses universal port numbers called well-known port numbers (permanent). Every client process must knows the well-known port number of the corresponding server process to communicate Fig: port number By: Er. Bednidhi Rijal
9
IP Address VS Port Address
The destination IP address defines the host among the different hosts in the world. After the host has been selected, the port number defines one of the processes on this particular host By: Er. Bednidhi Rijal
10
IP vs Port number By: Er. Bednidhi Rijal
11
IANA Ranges The IANA (Internet Assigned Number Authority) has divided the port numbers into three ranges: well known, registered, and dynamic (or private) Well-known ports The ports ranging from 0 to 1023 are assigned and controlled by IANA. These are the well-known ports. Registered ports The ports ranging from 1024 to 49,151 are not assigned or controlled by IANA. They can only be registered with IANA to prevent duplication. By: Er. Bednidhi Rijal
12
Contd.. Dynamic ports Fig: IANA Ranges
The ports ranging from 49,152 to 65,535 are neither controlled nor registered. They can be used by any process. These are the ephemeral ports. Fig: IANA Ranges By: Er. Bednidhi Rijal
13
Socket Addresses Process-to-process delivery needs two identifiers, IP address and the port number, at each end to make a connection. The combination of an IP address and a port number is called a socket address The client socket address defines the client process uniquely and the server socket address defines the server process uniquely A transport layer protocol needs a pair of socket addresses: the client socket address and the server socket address. By: Er. Bednidhi Rijal
14
Contd.. These four pieces of information are part of the IP header and the transport layer protocol header. The IP header contains the IP addresses; the UDP or TCP header contains the port numbers. By: Er. Bednidhi Rijal
15
Transmission Control Protocol (TCP)
TCP is called a connection-oriented; it creates a virtual connection between two TCPs to send data TCP uses flow and error control mechanisms at the transport level. It adds connection-oriented and reliability features to the services of IP. The major purpose of the TCP is to give the reliable and secure logical connection, service or circuit between the pairs of the processes By: Er. Bednidhi Rijal
16
Common TCP and UDP application and server port assignment
By: Er. Bednidhi Rijal
17
Characteristics of TCP
The major characteristics are: Reliable: Reliable protocol ensures that data sent from one machine to another will eventually be communicated correctly It does not guarantee that this data will be transmitted correctly within any particular amount of time-just that given amount time, it will arrive Connection-oriented: It involves a connection or session between the endpoints. In other words, each host is aware of the other and can maintain information about the state of communication between them The connection needs to be initialized and destroyed Full-duplex: By full-duplex we mean a mode of communication such that both sides can send and receive concurrently By: Er. Bednidhi Rijal
18
TCP Header The format of a segment is shown below:
By: Er. Bednidhi Rijal
19
Contd.. The segment consists of a 20 to 60 byte header, followed by data from the application program. The header is 20 bytes if there are no options and up to 60 bytes if it contains options. TCP headers fields are described below: Source port address. (16 bit field) Defines the port number of the application program in the host that is sending the segment. Destination port address. (16 bit field) Defines the port number of the application program in the host that is receiving the segment. By: Er. Bednidhi Rijal
20
Contd.. Sequence number. (32 bit field)
Defines the number assigned to the first byte of data contained in this segment. To ensure connectivity, each byte to be transmitted is numbered. The sequence number tells the destination which byte in this sequence comprises the first byte in the segment. Acknowledgment number. (32 bit field) This is the sequence number of the last byte being acknowledged. This is a piggy-backed acknowledgement. By: Er. Bednidhi Rijal
21
Contd.. Window size. Header length. Reserved.
This 4-bit field indicates the number of 4-byte words in the TCP header. The length of the header can be between 20 and 60 bytes. Therefore, the value of this field can be between 5 (5 x 4 =20) and 15 (15 x 4 =60). Reserved. This is a 6-bit field reserved for future use. Window size. This field defines the size of the window, in bytes, that the other party must maintain. Note that the length of this field is 16 bits, which means that the maximum size of the window is 65,535 bytes. This value is normally referred to as the receiving window (rwnd) and is determined by the receiver. The sender must obey the dictation of the receiver in this case. By: Er. Bednidhi Rijal
22
Contd.. Checksum. Urgent pointer (16 bit field) Options. Padding: Data
This 16-bit field contains the checksum. Checksum is used to detect the unusual types of errors. Urgent pointer (16 bit field) Provision for TCP for some urgent for some urgent data messages to be sent bypassing the normal sequence number system. This field is used to indicate where such data is stored in the packets. Options. There can be up to 40 bytes of optional information in the TCP header. Padding: It is added to make the header a multiple of 32 bits long and is only used when options are used. Data The data field is passed intact to the program which is receiving packets addressed to this port By: Er. Bednidhi Rijal
23
Control field ' By: Er. Bednidhi Rijal
24
Relation between TCP and IP
TCP is connection oriented protocol but IP is connectionless protocol. TCP uses the services of IP to deliver individual segments to the receiver, but it controls the connection itself. If a segment is lost or corrupted, it is retransmitted. Unlike TCP, IP is unaware of this retransmission. If a segment arrives out of order, TCP holds it until the missing segments arrive; IP is unaware of this reordering. By: Er. Bednidhi Rijal
25
A TCP Connection TCP is connection-oriented.
A connection-oriented transport protocol establishes a virtual path (not physical path) between the source and destination. All the segments belonging to a message are then sent over this virtual path. Using a single virtual pathway for the entire message facilitates the acknowledgment process as well as retransmission of damaged or lost frames. TCP operates at a higher level. In TCP, connection-oriented transmission requires three phases: connection establishment, data transfer, and connection termination. By: Er. Bednidhi Rijal
26
Connection Establishment
TCP transmits data in full-duplex mode. For this each party must initialize communication and get approval from the other party before any data are transferred. TCP uses a three-way handshake to establish a connection Guarantees both sides ready to transfer data Allows both sides to agree on initial sequence numbers Initial sequence number (ISN) must be chosen so that each incarnation of a specific TCP connection between two end-points has a different ISN. The connection establishment process involves: By: Er. Bednidhi Rijal
27
Contd.. Step 1 Client sends first segment with SYN flag set Includes source and destination port numbers Includes initialization sequence number for numbering client’s segments Step 2 Server sends a segment with both SYN and ACK flags set The ACK flag acknowledges receipt of the client’s SYN segment The ACK number is the client’s ISN + 1 in this case because client’s segment had no payload data The SYN number is the server’s ISN Step 3 Client sends segment with ACK flag set to acknowledge server’s segment The ACK number is the server’s ISN + 1 because there was no payload data By: Er. Bednidhi Rijal
28
Connection establishment using three-way handshaking
Normally, client initiates the connection By: Er. Bednidhi Rijal
29
TCP Connection termination
Termination is a 4-step process Step 1 Client sends a segment with the FIN flag set Step 2 Server sends an ACK back Step 3 Server finishes sending data if it has more to send When all server data has been sent, server sends a FIN segment Step 4 Client sends and ACK back to server By: Er. Bednidhi Rijal
30
Contd.. Normally, client performs active close and server performs passive close By: Er. Bednidhi Rijal
31
User Datagram Protocol (UDP)
The User Datagram Protocol (UDP) is called a connectionless, unreliable transport protocol. It does not add anything to the services of IP except to provide process-to process communication instead of host-to-host communication. It only performs very limited error checking. UDP is a very simple protocol using a minimum of overhead and can be used to send message where the reliability issue is not concerned. For example: Real time communication like voice, video etc. By: Er. Bednidhi Rijal
32
UDP Operation Connectionless services Flow and Error control
Each user datagram sent by UDP is an independent datagram The user datagrams are not numbered No connection establishment and no connection termination (each user datagram can travel on a different path) Flow and Error control Simple, unreliable transport protocol No flow control and hence no window mechanism Receiver may overwhelm with incoming message No error control mechanism except for the checksum Encapsulation and De-capsulation To send a message from one process to another, the UDP protocol encapsulates and de-capsulates messages in an IP datagram By: Er. Bednidhi Rijal
33
UDP Format By: Er. Bednidhi Rijal
34
Contd.. Source port number (16 bit long)
This is the port number used by the process running on the source host. If the source host is the client (a client sending a request), the port number is an ephemeral port and If the source host is the server the port number is a well-known port number. Destination port number (16 bit long) This is the port number used by the process running on the destination host. If the destination host is the server the port number is a well-known port number and If the destination host is the client the port number is an ephemeral port number By: Er. Bednidhi Rijal
35
Contd.. Length (16 bit long) Checksum Data
Contains the total length of the user datagram, header plus data. Checksum This field is used to detect errors over the entire user datagram (header + data) Data This field is passed to the relevant program By: Er. Bednidhi Rijal
36
Use of UDP The following lists some uses of the UDP protocol:
UDP is suitable for a process that requires simple request-response communication with little concern for flow and error control. It is not usually used for a process such as FTP that needs to send bulk data UDP is suitable for a process with internal flow and error control mechanisms. For example, the Trivial File Transfer Protocol (TFTP) process includes flow and error control. It can easily use UDP. UDP is a suitable transport protocol for multicasting. Multicasting capability is embedded in the UDP software but not in the TCP software. UDP is used for management processes such as SNMP. UDP is used for some route updating protocols such as Routing Information Protocol (RIP) By: Er. Bednidhi Rijal
37
Uses of TCP TCP: Almost anything where you have to get all transmitted data Web SSH, FTP, telnet SMTP, sending mail IMAP/POP, receiving mail By: Er. Bednidhi Rijal
38
Overview of BSD Socket API (BERKELEY)
The Microsoft Windows platform supplies a windows socket API called Winsock that implements the BSD socket API Comprises a library for developing applications in C language that performs inter-process communication in computer network Allows application processes to open the communication “sockets” that can then be assigned to a particular integer port number on the host Once a connection is established between two stream sockets, either side can send and receive guaranteed data to the other. Note: API:- Application Programming Interface By: Er. Bednidhi Rijal
39
Contd.. Sockets created to use the TCP stream protocol can either be set to “listen()” for connections from remote hosts, or can be set to “connect()” to a remote host that is currently listening for incoming connections The socket API contains other utility routines for performing operations such as host name resolution and socket options configuration, such as: Socket() – create new socket Accept() – accepting connection Send(), write() Read(), sendto() Close() By: Er. Bednidhi Rijal
40
Contd.. Sockets can also be created in datagram mode, in which case they will use the underlying UDP protocol for transmission of datagram packets Since the datagram socket mode is connectionless, the destination IP address and port must be specified with each data packet sent. By: Er. Bednidhi Rijal
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.