Lec TCP-UDP
Lec TCP-UDP
Lec TCP-UDP
24.2
Port Numbers
- Port numbers provide end-to-end addresses at the transport layer
24.3
UDP
The User Datagram Protocol (UDP) is a connectionless, unreliable transport protocol
- UDP is a very simple protocol using a minimum of overhead.
- UDP packets, called user datagrams, have a fixed-size header of 8 bytes made of four fields,
each of 2 bytes (16 bits)
- UDP Format
- The first two fields define the source and destination port
numbers.
- The third field defines the total length of the user datagram, header plus data
- The last field can carry the checksum
4
UDP
Find
a. What is the source port number?
b. What is the destination port number?
c. What is the total length of the user datagram?
d. What is the length of the data?
e. Is the packet directed from a client to a server or vice versa?
f. What is the client process?
5
Solution
a. The source port number is the first four hexadecimal digits (CB84)16
or 52100
b. The destination port number is the second four hexadecimal
digits (000D)16 or 13.
c. The third four hexadecimal digits (001C)16 define the length of the
whole UDP packet as 28 bytes.
d. The length of the data is the length of the whole packet minus the length of the header,
or 28 − 8 = 20 bytes.
e. Since the destination port number is 13 (well-known port), the packet
is from the client to the server.
f. The client process is the Daytime.
6
TCP
-I is a connection-oriented
- reliable protocol
- explicitly defines connection establishment, data transfer, and connection teardown phases
Sending Receiving
process process
S t re a m of b y t es
7
TCP Segment
8
Control Flags
9
Three way Handshaking- connection establishment
10
Connection termination using three-way handshaking
24.11
Exercise
12
Exercise
13
14
Practice Questions
The following is a dump of a TCP header in hexadecimal format.
05320017 00000001 00000000 500207FF 00000000
1.What is the source port number?
Source port number = (0532)16 = 1330
2. What is the destination port number?
Destination port number = (0017)16 = 23
3. What the sequence number?
Sequence number = (00000001)16
4. What is the acknowledgment number?
Acknowledgement number = (00000000)16
5. What is the length of the header?
Length of the header = 5*4 = 20
6. What is the type of the segment?
It is a SYN segment.
15
Practice Questions
In a TCP connection, the initial sequence number at client site is 2171. The client opens the
connection, sends only one segment carrying 1000 bytes of data, and closes the connection. What is
the value of the sequence number in each of the following segments sent by the client?
16
Practice Questions
Ques: Specify three reasons why TCP may not be suitable for real time video streaming.
Sol:
1. TCP induces delay while ensuring reliable transmission of data. For real time video
streaming delays are unacceptable.
2. Retransmission of data packets when there is packet loss would result in arrival of data
later than the normal time. This would lead to a lag and the data would no more be real
time.
3. Using congestion and flow control mechanisms, the throughput of TCP is reduced to avoid
packet losses. A reduced throughput is not ideal for real time video.
17