TCP and UDP
TCP and UDP
http://www.ports-services.com/
Some well-known ports
HTTP 80
HTTPS 443
SMTP 25
DNS 53
POP3 110
POP3S 995
SSH 22
TELNET23
FTP 21
TCP – Transmission Control
Protocol
RFCs 793, 1122, 1323, 2018, 2581
Point-to-Point
one sender, one receiver
Reliable, in-order byte steam
no “message boundaries”
Pipelined
Send & Receive buffers/windows
a p p lic a t io n a p p lic a t io n
w r it e s d a t a re a d s d a ta
socket socket
door door
TC P TC P
s e n d b u ffe r r e c e iv e b u f f e r
segm ent
TCP – Transmission Control
Protocol
Full duplex
bi-directional data flow in same connection
Connection-oriented
Exchange of control messages initiates sender,
receiver state before data exchange
Flow control and Congestion Control
sender will not overwhelm receiver or the network
TCP Connections
1. Connection establishment
2. Data transfer
3. Connection termination
Connection Establishment
Three-way Handshake
Passive Open
Before a client attempts to connect with a server,
the server must first bind to a port to open it up for
connections
Active Open
Once the passive open is established, a client
may initiate an active open
To establish a connection, the three-way (or
3-step) handshake occurs
Three-way Handshake
1. The active open is performed by sending a SYN to the
server
2. In response, the server replies with a SYN-ACK
3. Finally the client sends an ACK (usually called SYN-ACK-
ACK) back to the server
Three-way Handshake
SYN Flood Attack
Connection Release
Connection Release
Intrusion Prevention System
FIN
ACK o
fF IN
TCP Connection Management Modeling
New bytes
Bytes have
Operations on the window
been
can be
added
acknowledged
Opened, Closed or Shrunk
Executed as per the information from the receiver
Example scenario for Sliding
Window
Example scenario for Sliding
Window
The server receives a packet with an acknowledgment value of
202 and an rwnd of 9. The host has already sent bytes 203, 204,
and 205. The value of cwnd is still 20. Show the new window
Window Shutdown
rwnd = 0
When receiver does not wants to receive data for
some time
Sender stops sending data until the new
advertisement arrives from receiver
If there is no data, receiver still sends an ACK with new
rwnd value
Summary of Flow Control
UDP – User Datagram Protocol
Simplicity itself
No connection setup is needed in advance
No release at the end
No flow control
No retransmissions
Error Control is optional
Length
Length of the entire UDP datagram (Header +
Payload)
Checksum
Checksum of (Pseudo-header + Header + Payload)