ComputerNetworkNotesFYCSPillais
ComputerNetworkNotesFYCSPillais
The transport layer is responsible for process-to-process delivery of the entire message.
A process is an application program or part of it which is currently running on a computer.
Network layer oversees source-to-destination delivery of individual packets, it does not
recognize any relationship between those packets. It treats each one independently, as though
each piece belonged to a separate message, whether or not it does.
Transport layer, on the other hand, ensures that the whole message arrives intact and in order,
overseeing both error control and flow control at the source-to-destination level.
“The transport layer is responsible for the delivery of a message from one process to another.”
Transport layer header must include a type of address called a service-point address in the OSI
model and port number or port addresses in the Internet and TCP/IP protocol suite. Transport
layer protocol can be either connectionless or connection-oriented.
Connectionless transport layer treats each segment as an independent packet and delivers it to the
transport layer at the destination machine.
Connection-oriented transport layer makes a connection with the transport layer at the
destination machine first before delivering the packets. After all the data is transferred, the
connection is terminated.
Internet Assigned Number Authority (IANA) has divided the port numbers into three
ranges: well known, registered, and dynamic (or private)
1.Well-known ports. The ports ranging from 0 to 1023 are assigned and controlled by lANA.
These are the well-known ports.
2.Registered ports. The ports ranging from 1024 to 49,151 are not assigned or controlled by
lANA. They can only be registered with lANA to prevent duplication.
3. Dynamic ports. 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.
Socket address - 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. A transport layer protocol needs a pair of socket addresses: the client
socket address and the server socket address. 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.
Connectionless Service
In a connectionless service, the packets are sent from one party to another with no need for
connection establishment or connection release. The packets are not numbered; they may be
delayed or lost or may arrive out of sequence. There is no acknowledgment either.
Connection~Oriented Service
In a connection-oriented service, a connection is first established between the sender and the
receiver. Data are transferred. At the end, the connection is released.
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. Also, it performs very limited error checking.
Disadvantage of UDP is it is powerless but it is a very simple protocol using a minimum of
overhead. If a process wants to send a small message and does not care much about reliability, it
can use UDP. Sending a small message by using UDP takes much less interaction between the
sender and receiver than using TCP or SCTP.
User Datagram
UDP packets, called user datagrams, have a fixed-size header of 8 bytes.
The fields are as follows:
1.Source port number. This is the port number used by the process running on the source host. It
is 16 bits long, which means that the port number can range from 0 to 65,535. If the source host
is the client (a client sending a request), the port number, in most cases, is an ephemeral port
number requested by the process and chosen by the UDP software running on the source host. If
the source host is the server (a server sending a response), the port number, in most cases, is a
well-known port number.
2. Destination port number. This is the port number used by the process running on the
destination host. It is also 16 bits long. If the destination host is the server (a client sending a
request), the port number, in most cases, is a well-known port number. If the destination host is
the client (a server sending a response), the port number, in most cases, is an ephemeral port
number. In this case, the server copies the ephemeral port number it has received in the request
packet.
3. Length. This is a 16-bit field that defines the total length of the user datagram, header plus
data. The 16 bits can define a total length of 0 to 65,535 bytes. However, the total length needs to
be much less because a UDP user datagram is stored in an IP datagram with a total length of
65,535 bytes.
The length field in a UDP user datagram is actually not necessary. A user datagram is
encapsulated in an IP datagram. There is a field in the IP datagram that defines the total length.
There is another field in the IP datagram that defines the length of the header. So if we subtract
the value of the second field from the first, we can deduce the length of a UDP datagram that is
encapsulated in an IP datagram.
UDP length = IP length - IP header's length
4. Checksum. This field is used to detect errors over the entire user datagram (header plus data).
UDP Operation
Connectionless Services
UDP provides a connectionless service. This means that each user datagram sent by UDP is an
independent datagram. There is no relationship between the different user datagrams even if they
are coming from the same source process and going to the same destination program. The user
datagrams are not numbered.
Also, there is no connection establishment and no connection termination, as is the case for TCP.
This means that each user datagram can travel on a different path.
One of the ramifications of being connectionless is that the process that uses UDP cannot send a
stream of data to UDP and expect UDP to chop them into different related user datagrams.
Instead each request must be small enough to fit into one user datagram. Only those processes
sending short messages should use UDP.
TCP Services
Process-to-Process Communication
Like UDP, TCP provides process-to-process communication using well known port numbers.
Full-Duplex Communication
TCP offers full-duplex service, in which data can flow in both directions at the same time. Each
TCP then has a sending and receiving buffer, and segments move in both directions.
Connection-Oriented Service
TCP, unlike UDP, is a connection-oriented protocol. When a process at site A wants to send and
receive data from another process at site B, the following occurs:
1. The two TCPs establish a connection between them.
2. Data are exchanged in both directions.
3. The connection is terminated.
Note that this is a virtual connection, not a physical connection. The TCP segment is
encapsulated in an IP datagram and can be sent out of order, or lost, or corrupted, and then
resent. Each may use a different path to reach the destination. There is no physical connection.
TCP creates a stream-oriented environment in which it accepts the responsibility of delivering
the bytes in order to the other site. The situation is similar to creating a bridge that spans multiple
islands and passing all the bytes from one island to another in one single connection.
Reliable Service
TCP is a reliable transport protocol. It uses an acknowledgment mechanism to check the safe and
sound arrival of data.
TCP 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.
1. Source port address. This is a 16-bit field that defines the port number of the application
program in the host that is sending the segment. This serves the same purpose as the source port
address in the UDP header.
2. Destination port address. This is a 16-bit field that defines the port number of the application
program in the host that is receiving the segment. This serves the same purpose as the destination
port address in the UDP header.
3. Sequence number. This 32-bit field defines the number assigned to the first byte of data
contained in this segment. TCP is a stream transport protocol. 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.
4. Acknowledgment number. This 32-bit field defines the byte number that the receiver of the
segment is expecting to receive from the other party. If the receiver of the segment has
successfully received byte number x from the other party, it defines x + I as the acknowledgment
number. Acknowledgment and data can be piggybacked together.
5. Header length. 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, thevalue of this field can be
between 5 (5 x 4 =20) and 15 (15 x 4 =60).
7. Control. This field defines 6 different control bits or flags. One or more of these bits can be set
at a time.