0% found this document useful (0 votes)
10 views10 pages

Understanding UDP and TCP Protocols

The document discusses network connection and protocols, focusing on the transport layer, specifically UDP and TCP protocols. UDP is a connectionless and unreliable protocol suitable for applications requiring speed over reliability, while TCP is a connection-oriented and reliable protocol essential for major Internet applications. Additionally, it covers routing protocols like OSPF and BGP, as well as Ethernet cable types, including straight and crossover cables.

Uploaded by

tony onyango
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views10 pages

Understanding UDP and TCP Protocols

The document discusses network connection and protocols, focusing on the transport layer, specifically UDP and TCP protocols. UDP is a connectionless and unreliable protocol suitable for applications requiring speed over reliability, while TCP is a connection-oriented and reliable protocol essential for major Internet applications. Additionally, it covers routing protocols like OSPF and BGP, as well as Ethernet cable types, including straight and crossover cables.

Uploaded by

tony onyango
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

DCN TOPIC 4 NETWORK CONNECTION AND PROTOCOLS

Transport layer provides end-to-end or host-to-host communication services for applications


within a layered architecture of network components and protocols. The transport layer
provides
services such as connection-oriented data stream support, reliability, flow control, and
multiplexing.

1. UDP Protocol
UDP provides connectionless, unreliable, datagram service. Connectionless service means
that there is no logical connection between the two ends exchanging messages. Each message
is an independent entity encapsulated in a datagram.
UDP does not see any relation (connection) between consequent datagram coming from the
same source and going to the same destination.
UDP has an advantage: it is message-oriented. It gives boundaries to the messages
exchanged. An application program may be designed to use UDP if it is sending small
messages and the simplicity and speed is more important for the application than reliability.

User Datagram
UDP packets, called user datagram, have a fixed-size header of 8 bytes made of four fields,
each of 2 bytes (16 bits).
The 16 bits can define a total length of 0 to 65,535 bytes. However, the total length needs to
be less because a UDP user datagram is stored in an IP datagram with the total length of
65,535 bytes. The last field can carry the optional checksum

UDP Services

Process-to-Process Communication
UDP provides process-to-process communication using socket addresses, a combination of
IP addresses and port numbers.

Connectionless Services
As mentioned previously, UDP provides a connection less service. This means that each user
datagram sent by UDP is an independent datagram. There is no relationship between the
different user data grams even if they are coming from the same source process and going to
the same destination program.

Flow Control
UDP is a very simple protocol. There is no flow control, and hence no window mechanism.
The receiver may overflow with incoming messages.

Error Control
There is no error control mechanism in UDP except for the checksum. This means that the
sender does not know if a message has been lost or duplicated.

Checksum
UDP checksum calculation includes three sections: a pseudo header, the UDP header, and the
data coming from the application layer. The pseudo header is the part of the header of the IP
packet in which the user datagram is to be encapsulated with some fields filled with 0s.

UDP Applications

Typical Applications
• UDP is suitable for a process that requires simple request-response communication
with little concern for flow and error control
• UDP is suitable for a process with internal flow- and error-control mechanisms. For
example, the Trivial File Transfer Protocol (TFIP)
• UDP is a suitable transport protocol for multicasting. Multicasting capability is
embedded in the UDP software
• UDP is used for management processes such as SNMP
• UDP is used for some route updating protocols such as Routing Information Protocol
(RIP)
• UDP is normally used for interactive real-time applications that cannot tolerate
uneven delay between sections of a received message
2. TCP Protocol
Transmission Control Protocol (TCP) is a connection-oriented, reliable protocol. TCP
explicitly defines connection establishment, data transfer, and connection teardown phases to
provide a connection-oriented service. TCP is the protocol that major Internet applications
such as the World Wide Web, email, remote administration and file transfer rely on.

TCP Services
Process-to-Process Communication
As with UDP, TCP provides process-to-process communication using port numbers. We have
already given some of the port numbers used by TCP.

Stream Delivery Service


In UDP, a process sends messages with predefined boundaries to UDP for delivery. UDP
adds its own header to each of these messages and delivers it to IP for transmission.
TCP, on the other hand, allows the sending process to deliver data as a stream of bytes and
allows the receiving process to obtain data as a stream of bytes.
TCP creates an environment in which the two processes seem to be connected by an
imaginary "tube" that carries their bytes across the Internet.

Segments
• The network layer, as a service provider for TCP, needs to send data in packets, not as
a stream of bytes. At the transport layer, TCP groups a number of bytes together into a
packet called a segment.
• The segments are encapsulated in an IP datagram and transmitted. This entire
operation is transparent to the receiving process.
TCP PACKET Format

he individual components or fields of the header of the TCP protocol have the following meaning:

Source port (16 bits): Identifies the port number of the sender.

Destination port (16 bits): Identifies the port number of receiver.

Sequence number (32 bits): The sequence number specifies the first byte of attached payload
data or is sent when the connection is established or terminated. It is also used for validating and
sorting the segments after transmission.

Acknowledgment number (32 bits): This field contains the next sequence number that the
sender is expecting. An ACK flag (in the “Flags” field) is a precondition for validity.

Offset (4 bits): The “Offset” field specifies the length of the TCP header in 32-bit words to
highlight the starting point of the payload data. This starting point varies from segment to
segment due to the variable “Options” field.

Reserved (6 bits): Reserved for future use according to RFC 793 and not yet in use. This field
must always be set to 0.

Flags (6 bits): The six possible single bits in the “Flags” field enable various TCP actions for
organizing communication and data processing. The following flags are either set or not set for
these actions:

• URG: The "Urgent" flag signals to the TCP application that the payload data must be
processed immediately up to the set Urgent pointer (see above).
• ACK: In combination with the acknowledgment number, the ACK flag acknowledges the
receipt of TCP packets. If the flag is not set, the confirmation number is also invalid.
• PSH: The "Push" flag ensures that a TCP segment is immediately pushed through
without first being sent to the buffer of the sender and receiver.
• RST: If there is an error during transmission, a TCP packet with the RST flag set can be
used to reset the connection.
• SYN: Messages that have SYN flag set represent the first step of the three-way
handshake, meaning they initiate the connection.
• FIN: The "Finish" flag signals to the other party that a sender is ending the transmission.

Window size (16 bits): This field specifies the number of bytes that the sender is willing to
receive.
Checksum (16 bits): The Transmission Control Protocol can reliably detect transmission errors.
The checksum calculated from the header, the payload data and the pseudo-header is used for
this purpose.

Urgent pointer (16 bits): The urgent pointer indicates the position of the first byte after the
payload data that is to be processed urgently. As a result, this field is only valid and relevant if
the URG flag is set.

Options (0 - 320 bits): Use the Options field if you want to include TCP functions that don’t
belong in the general header, for example if you want to define the maximum segment size. The
length of the options must always be a multiple of 32, otherwise zero-bit padding is required.

TCP Handshake Protocol

Three-Way HandShake or a TCP 3-way handshake is a process which is used in a TCP/IP


network to make a connection between the server and client. It is a three-step process
that requires both the client and server to exchange synchronization and
acknowledgment packets before the real data communication process starts

TCP message types


Message Description
Used to initiate and establish a connection. It also helps you to synchronize sequence numbers
Syn
between devices.
ACK Helps to confirm to the other side that it has received the SYN.

SYN-ACK SYN message from local device and ACK of the earlier packet.

FIN Used to terminate a connection.

TCP provides reliable communication with something called Positive Acknowledgement


with Re-transmission (PAR). The Protocol Data Unit (PDU) of the transport layer is called
segment. Now a device using PAR resend the data unit until it receives an
acknowledgement. If the data unit received at the receiver’s end is damaged (It checks
the data with checksum functionality of the transport layer that is used for Error
Detection), then receiver discards the segment. So, the sender has to resend the data unit
for which positive acknowledgement is not received.
- Step 1 (SYN) : In the first step, client wants to establish a connection with
server, so it sends a segment with SYN(Synchronize Sequence Number)
which informs server that client is likely to start communication and with what
sequence number it starts segments with
- Step 2 (SYN + ACK): Server responds to the client request with SYN-ACK
signal bits set. Acknowledgement(ACK) signifies the response of segment it
received and SYN signifies with what sequence number it is likely to start the
segments with
- Step 3 (ACK) : In the final part client acknowledges the response of server
and they both establish a reliable connection with which they will start the
actual data transfer

The steps 1, 2 establish the connection parameter (sequence number) for one
direction and it is acknowledged. The steps 2, 3 establish the connection parameter
(sequence number) for the other direction and it is acknowledged. With these, a full-
duplex communication is established.

Note – Initial sequence numbers are randomly selected while establishing


connections between client and server.

Other protocols
1. Open Shortest Path First (OSPF) is a routing protocol for Internet Protocol (IP)
networks. It uses a link state routing algorithm and falls into the group of interior
routing protocols, operating within a single autonomous system (AS). It is defined as
OSPF Version 2 in RFC 2328 (1998) for IPv4. The updates for IPv6 are specified as
OSPF Version 3 in RFC 5340 (2008). OSPF is perhaps the most widely used interior
gateway protocol (IGP) in large enterprise networks. Intermediate System to
Intermediate System (IS-IS), another link-state dynamic routing protocol, is more
common in large service provider networks. The most widely used
exterior gateway protocol is the Border Gateway Protocol (BGP), the principal routing
protocol between autonomous systems on the Internet.

2. Border Gateway Protocol (BGP) is a standardized exterior gateway protocol


designed to exchange routing and reachability information between autonomous
systems (AS) on the Internet. The protocol is often classified as a path vector protocol
but is sometimes also classed as a distance-vector routing protocol. Makes routing
decisions based on paths, network policies, or rule-sets configured by a network
administrator and is involved in making core routing decisions.

Note
1. Exterior gateway protocol (EGP) is a routing protocol used to exchange routing
information between autonomous systems. While as Interior gateway protocol (IGP) is a
type of protocol used for exchanging routing information between gateways (commonly
routers) within an autonomous system (for example, a system of corporate local area
networks).
autonomous system (AS) is a collection of connected Internet Protocol (IP) routing prefixes
under the control of one or more network operators on behalf of a single administrative entity
or domain that presents a common, clearly defined routing policy to the Internet.
Routing Information Protocol (RIP) is one of the oldest distance-vector routing protocols,
which employs the hop count as a routing metric. RIP prevents routing loops by
implementing a limit on the number of hops allowed in a path from the source to a
destination.

2. Path vector protocol is a computer network routing protocol which maintains the path
information that gets updated dynamically. Updates which have looped through the network
and returned to the same node are easily detected and discarded. It is different from the
distance vector routing and link state routing. Each entry in the routing table contains the
destination network, the next router and the path to reach the destination.
Distance-vector routing protocol is one of the two major classes of intra domain routing
protocols, A distance-vector routing protocol requires that a router inform its neighbors of
topology changes periodically.
Link-state routing protocols are one of the other main classes of routing protocols link-state
protocol is performed by every switching node in the network (i.e., nodes that are prepared to
forward packets; in the Internet, these are called routers). The basic concept of link-state
routing is that every node constructs a map of the connectivity to the network, in the form of
a graph, showing which nodes are connected to which other nodes. Each node then
independently calculates the next best logical path from it to every possible destination in the
network. The collection of best paths will then form the node's routing table.

Network connectivity
What are Straight and Crossover cable
Common Ethernet network cable are straight and crossover cable. This Ethernet network
cable is
made of 4 pair high performance cable that consists twisted pair conductors that used for data
transmission. Both end of cable is called RJ45 connector.
The cable can be categorized as Cat 5, Cat 5e, Cat 6 UTP cable. Cat 5 UTP cable can support 10/100
Mbps Ethernet network, whereas Cat 5e and Cat 6 UTP cable can support Ethernet network running
at 10/100/1000 Mbps. You might hear about Cat 3 UTP cable, it's not popular anymore since it can
only support 10 Mbps Ethernet network.
Straight and crossover cable can be Cat3, Cat 5, Cat 5e or Cat 6 UTP cable, the only
difference is each type will have different wire arrangement in the cable for serving different
purposes.

Straight Cable
You usually use straight cable to connect different type of devices. This type of cable will be
used most of the time and can be used to:
1) Connect a computer to a switch/hub's normal port.
2) Connect a computer to a cable/DSL modem's LAN port.
3) Connect a router's WAN port to a cable/DSL modem's LAN port.
4) Connect a router's LAN port to a switch/hub's uplink port. (normally used for expanding
network)
5) Connect 2 switches/hubs with one of the switch/hub using an uplink port and the other one
using normal port.
If you need to check how straight cable looks like, it's easy. Both side (side A and side B) of
cable have wire arrangement with same color. Check out different types of straight cable
that are available in the market here.
Crossover Cable
Sometimes you will use crossover cable, it's usually used to connect same type of devices. A
crossover cable can be used to:
1) Connect 2 computers directly.
2) Connect a router's LAN port to a switch/hub's normal port. (normally used for expanding
network)
3) Connect 2 switches/hubs by using normal port in both switches/hubs.
In you need to check how crossover cable looks like, both side (side A and side B) of cable
have wire arrangement with following different color . Have a look on these crossover
cables if you plan to buy one.

You might also like