Seach in Techno Google

Thursday, February 14, 2008

About TCP/IP

What is TCP?

TCP (Transmission Control Protocol) is the main transport protocol utilized in IP networks.
The TCP protocol exists on the Transport Layer of the OSI Model.
The TCP protocol is a connection-oriented protocol which provides end-to-end reliability.
By connection-oriented, we mean that before two network nodes can communicate using TCP, they must first complete a handshaking protocol to create a connection.
When we say that TCP provides end-to-end reliability, we mean that TCP includes mechanisms for error detection and error correction between the source and the destination.
These properties of TCP are in contrast to UDP, which is connectionless and unreliable.
Higher layer protocols which utilize TCP include HTTP, SMTP, NNTP, FTP, telnet, SSH, and LDAP.

Diagram of the TCP Header

TCP Header Format
-----------------

0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Source Port | Destination Port |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Sequence Number |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Acknowledgment Number |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Data | |U|A|P|R|S|F| |
| Offset| Reserved |R|C|S|S|Y|I| Window |
| | |G|K|H|T|N|N| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Checksum | Urgent Pointer |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Options | Padding |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| data |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

UDP

(User Datagram Protocol) is one of the two main transport protocols utilized in IP networks.
The UDP protocol exists on the Transport Layer of the OSI Model.
The UDP protocol is an unreliable connectionless protocol.
When we say that UDP is unreliable, we mean that UDP does not provide mechanisms for error detection and error correction between the source and the destination. Because of this, UDP utilized bandwidth more efficiently than TCP. Applications which utilize UDP and which require reliable transport must provide their own error detection and correction mechanisms.
By connectionless, we mean that a network node can communicate with another network node using UDP without first negotiating any kind of handshaking or creating a connection. Because of this, UDP is very efficient for protocols that send small amounts of data at irregular intervals.
These properties of UDP are in contrast to TCP, which is connection-oriented and provides end-to-end reliability.
Higher layer protocols which utilize UDP include DNS, BOOTP, DHCP, SNMP, and RADIUS.

Diagram of the UDP Header

UDP Header Format
-----------------

0 7 8 15 16 23 24 31
+--------+--------+--------+--------+
| Source | Destination |
| Port | Port |
+--------+--------+--------+--------+
| | |
| Length | Checksum |
+--------+--------+--------+--------+
| +
| data octets ... +
+-----------------------------------+

What are TCP/IP ports?

TCP and IP are two seperate protocols. IP (Internet Protocol) is a network layer protocol, while TCP (Transmission Control Protocol) is a transport layer protocol.
Every computer and network device attached to the Internet has at least one IP address. For example, the IP address of this web server is 66.37.153.81.
Then, within each of those IP addresses, each computer and network device will have a number of TCP ports. For example, the web server software on this web server responds on TCP port 80 and the mail server software on the same computer responds on TCP port 25.
In a non-technical sense, you can think of an IP address as the address of an office building and the TCP ports are individual offices within that building.

TCP Ports

TCP ports either originate connections or they receive connections. Any TCP port can originate a connection, and the port numbers for those are not important. TCP ports which receive connections, on the other hand, have to be assigned specific port numbers so that people and applications know where to look for them. For example, DNS answers on TCP port 53 and HTTP answers on TCP port 80.
Port numbers that are statically assigned are known as well known port numbers are are usually below 1,024. To see a list of well known TCP ports, read What port number is XXX on?.








No comments: