Add links, fix typos

This commit is contained in:
Surya 2020-12-13 16:35:29 +05:30
parent 883a26938b
commit 476ef3ec81

View File

@ -1,10 +1,10 @@
---
layout: post
title: TCP connections in applications
title: Connections
categories: ["networks"]
---
This is a continuation of the previous article on the OSI model. The Internet Protocol Suite consists of multiple protocol specifications that are implemented by almost all computers and other network devices. One primary abstraction available to the developers in process to process communication scenarios is a **connection**. The developer would get a hold on a connection object and send and receive information through it.
This is a continuation of the [previous article]({{ site.baseurl }}{% link _posts/2020-12-09-osi.markdown %}) on the OSI model. The Internet Protocol Suite consists of multiple protocol specifications that are implemented by almost all computers and other network devices. One primary abstraction available to the developers in process to process communication scenarios is a **connection**. The developer would get a hold on a connection object and send and receive information through it.
Available to the application developer are 2 widely used connection protocols - [Transmission Control Protocol](https://en.wikipedia.org/wiki/Transmission_Control_Protocol) and [User Datagram Protocol](https://en.wikipedia.org/wiki/User_Datagram_Protocol). While both the protocols are in general use, TCP is the most common connection protocol in use. It is also the protocol that developers are mostly going to concern themselves with. Therefore, this post will focus on TCP.
@ -22,7 +22,7 @@ The Internet is a network.
## IP Address
An IP address is an identifier for a machine in a network. It was initially 32 bits in size, but for more than 2 decades now, a 64 bit version is also in use. The limitation of the 32 bit address is that [there are more than 2<sup>32<\sup> devices](https://en.wikipedia.org/wiki/IPv4_address_exhaustion) connected to the internet. There are some mitigation strategies for this limitation that change how these 32 bit addresses are handled and exposed.
An IP address is an identifier for a machine in a network. It was initially 32 bits in size, but for more than 2 decades now, a 64 bit version is also in use. The limitation of the 32 bit address is that [there are more than **2<sup>32</sup>** devices](https://en.wikipedia.org/wiki/IPv4_address_exhaustion) connected to the internet. There are some mitigation strategies for this limitation that change how these 32 bit addresses are handled and exposed.
Here's how the 2 versions of IP addresses are expressed for this site.
@ -62,13 +62,13 @@ A message in the below paragraphs is a connection + some message bytes.
To establish a TCP connection, the source computer sends a message called **SYN** - signalling start of connection establishment. The destination computer responds with a **SYN-ACK** - indicating that it is ready to accept a connection. The source receiving the **SYN-ACK** validates the target ip address. The source computer now sends an **ACK** - signalling that it will send messages using that 5-tuple from this point onwards. The destination receiving this **ACK** means that the destination's previous message reached the source, validating the ip address of the source for the destination.
1. Source : Send SYN, (IP<sub>source</sub>, Port<sub>source</sub>, IP<sub>destination</sub>, Port<sub>destination</sub>, TCP)
1. Destination : Receive SYN, (IP<sub>source</sub>, Port<sub>source</sub>, IP<sub>destination</sub>, Port<sub>destination</sub>, TCP)
1. Destination : Send SYN-ACK (IP<sub>destination</sub>, Port<sub>destination</sub>, IP<sub>source</sub>, Port<sub>source</sub>, TCP)
1. Source : Receive SYN_ACK (IP<sub>destination</sub>, Port<sub>destination</sub>, IP<sub>source</sub>, Port<sub>source</sub>, TCP)
1. Source : Send ACK (IP<sub>source</sub>, Port<sub>source</sub>, IP<sub>destination</sub>, Port<sub>destination</sub>, TCP)
1. Source : Send SYN, (IP<sub>source</sub>, Port<sub>source</sub>, IP<sub>dest</sub>, Port<sub>dest</sub>, TCP)
1. Destination : Receive SYN, (IP<sub>source</sub>, Port<sub>source</sub>, IP<sub>dest</sub>, Port<sub>dest</sub>, TCP)
1. Destination : Send SYN-ACK (IP<sub>dest</sub>, Port<sub>dest</sub>, IP<sub>source</sub>, Port<sub>source</sub>, TCP)
1. Source : Receive SYN_ACK (IP<sub>dest</sub>, Port<sub>dest</sub>, IP<sub>source</sub>, Port<sub>source</sub>, TCP)
1. Source : Send ACK (IP<sub>source</sub>, Port<sub>source</sub>, IP<sub>dest</sub>, Port<sub>dest</sub>, TCP)
1. Source : Mark connection as established.
1. Destination : Receive ACK (IP<sub>source</sub>, Port<sub>source</sub>, IP<sub>destination</sub>, Port<sub>destination</sub>, TCP)
1. Destination : Receive ACK (IP<sub>source</sub>, Port<sub>source</sub>, IP<sub>dest</sub>, Port<sub>dest</sub>, TCP)
1. Destination : Mark connection as established.
This handshake is also called the [3-way handshake](https://en.wikipedia.org/wiki/Handshaking). This establishes the source and target ip address validity.