|
TCP/IP
Protocols: TCP and UDP
TRANSMISSION
CONTROL PROTOCOL (TCP)
BACKGROUND
As opposed to IP, TCP is connection oriented and assures reliable delivery
of packets. When the destination host receives a segment it sends back
an acknowledgement (ACK). If an ACK is not received by the source host
within a certain period of time then the data is retransmitted. TCP
uses sockets and ports to exchange data between applications. Ports
provide a specific and universal location for message delivery, while
sockets use the host IP address, port number and the type of service
(TCP or UDP) to create a reliable connection. TCP uses sliding windows
to buffer data between hosts. A buffer that is too large or small can
cause poor network performance. For example, if you are shotgunning
a beer your throat is like the buffer. If your throat isn't opened wide
enough then the beer travels to your stomach very slowly. If your throat
is open too wide, then some of the beer packets get lost in your lungs
or you just throw up. You then have to retransmit the beer back to your
stomach.
THREE-WAY
HANDSHAKE
A TCP session begins with a three-way - Handshake that is. This process
synchronizes the sending and receiving of data.
1) The source
host sends a segment with the SYN flag set "on".
2) The destination host sends a reply with SYN flag "on",
a sequence number and an ACK that relays the next packet that the destination
host is expecting.
3) The source host sends and ACK with received sequence number and an
acknowledgement number. The session is ended with a similar process.
TCP HEADER
STRUCTURE
***SOURCE
PORT:
This is the
TCP port of the source host.
***DESTINATION
PORT:
TCP port
of receiving host
***ACKNOWLEDGEMENT
NUMBER:
The sequence
number of the packet that the receiving host is
expecting next.
***DATA LENGTH:
Length of
segment
***RESERVED:
Crappy explanations
everywhere so it must not be important.
***FLAGS:
Denotes the
content of the segment.
***WINDOW:
Specifies
how much space is left in the TCP window.
***CHECKSUM:
Makes sure
that the header is not corrupted.
***URGENT
POINTER:
If there
is a flag in the flags section that indicates that there is
urgent data included, this field shows where the end of this urgent
data is.
USER
DATAGRAM PROTOCOL (UDP)
BACKGROUND
UDP is a connectionless service that sends small amounts of data at
one time and does not guarantee delivery. It is commonly used with applications
such as NETSTAT, TFTP, SNMP, NETBIOS name service and NETBIOS datagram
service. Like TCP, UDP uses ports to provide the location to send packets.
HEADER
STRUCTURE
***SOURCE
PORT:
UDP port
of the source host
***DESTINATION
PORT:
UDP port
of receiving host
***MESSAGE
LENGTH:
The total
size of the UDP packet.
***CHECKSUM:
Verifies
that the header is intact.
|