How an application file is transferred over TCP/IP

Photo by Fionn Große on Unsplash

Let’s look at a brief overview of the dominant network models.

The Open Systems Interconnection (OSI) 7-layer model is used to characterize and standardize the communication functions of telecommunication or computing systems.

The TCP/IP 5-layer model was developed for the US Department of Defense’s packet switching network ARPANET (Advanced Research Projects Agency Network). Currently, it’s maintained by the IETF (Internet Engineering Task Force) under IAB (Internet Architecture Board).

In 1973, an Experimental Packet Switched System in the UK identified the requirement for defining the higher-level protocols. In 1984, the OSI architecture was formally adopted by ISO (International Organization for Standardization) as an international standard. In 1978, testing led to a new suite of protocols called TCP/IP. In 1982, it was decided that TCP/IP should be replaced with NCP (Network Control Program) as the standard language of the ARPANET. On January 1, 1983, ARPANET switched over to TCP/IP. ARPANET finished its existence in 1990. The Internet has since grown after its demise, and TCP/IP evolved to meet the changing requirements of the Internet. That’s about all that happened.

Looking at their differences, the most relevant being in the number of layers itself as we see in the diagram below.

If you wanna go into details, there are already a lot of cool articles there on both of them. So, let us move on to what the title suggests. We’ll see how network operations happen over TCP/IP with the example of an application data file transfer between two host computers.

Say, an application on Host computer A creates a user data file that needs to be transferred to Host computer B.

The application data file is divided into payload segments based on the MTU (Maximum Transfer Unit) size of the IP packet and Ethernet frame size requirements. This creates multiple payload segments that need to be transferred.

A TCP (Transmission Control Protocol) Header is then, added to the data segment, and both Computer Host A and B set up a TCP session using a TCP 3-way handshake.

The 3-way handshake is based upon the TCP units of both A and B, wherein firstly, A will send a SYN message to B requesting synchronization. In reply to A, B will acknowledge the synchronization request by sending an ACK and it also requests synchronization in the opposite direction by sending a SYN to A. Finally, A will acknowledge the synchronization request by sending back an ACK to B. Now, a TCP session has been established.

Error-Control and TCP Flow are only controlled end-to-end by Host computers A and B, not by the routers in between them.

An IP (Internet Protocol) Header is now added to form an IP packet. The IP Header includes the Source and Destination IP addresses. IPv4 (32-bit) and IPv6 (128-bit) have different IP headers.

Then, an Ethernet header and trailer are added to the IP packet which will be used by Ethernet switches. Ethernet switches will essentially conduct Flow and Error Control. Other protocols (e.g., Wi-Fi) will use their own protocol header and trailer.

The intermediate routers, R1, R2, and R3 will use the IP addresses to route the IP packets. Usually, routers use a routing table to determine where to send the packets and optimal routing paths are set up using routing algorithms.

The Ethernet frame will be received at Computer host B’s Network Interface Card (NIC). The Ethernet Header and Trailer will be used to detect errors in the frame. If an error is detected, the frame is discarded and frame retransmission is requested.

The Ethernet Header and Trailer are removed to reveal the IP packet. The IP packet header contains many network control functions which are checked, for e.g., ECN (Explicit Congestion Notification) in IPv4.

Now, the IP header is removed to reveal the TCP header. TCP will control the window size to increase or decrease the data transfer rate. TCP includes the port address that will connect the data to Computer host B’s application (APP X).

The TCP header is removed to reveal the payload segment. And finally, the payload segments are combined to reconstruct the application data file, which is then, delivered to APP X.

So, that's how an application data file is transferred between two host computers.

Hope you liked the content. Thanks, Have a great week!

--

--

--

Software Engineer in making!

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Django vs Laravel vs Nodejs: Best Backend Framework To Choose For 2022

How actually the code executes in C.

Creating a search and callback system in Unity — part 2, Use Linq to search through cases.

Galaxy Shooter Programming Core Challenge 1: New enemies!

It’s Time to Look at your Years Old Repository

Bots, Gravity Forms and Spam on WordPress

Internal Implementation of how Array List size increases dynamically in Java

First story — edit

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Mohammad Humayun Khan

Mohammad Humayun Khan

Software Engineer in making!

More from Medium

A Key Problem in Deployment

Practicing Beginner Simple Go Lang Programming Questions for Interview

Hyper-V: Setting Up Best Experience From Ubuntu 20.04 VM (Easy Step-By-Step Tutorial)

Why is my container crashing?