Close or Esc Key

Arduino Projects   |   Raspberry Pi   |   Electronic Circuits   |   AVR   |   PIC   |   8051   |   Electronic Projects

Transmission Control Protocol/Internet Protocol (TCP/IP) : IOT Part 28

Written By: 

Transmission Control Protocol (TCP) is a transport layer or routing protocol. The Internet Protocol (IPv4 and IPv6) is a network layer or adaption layer protocol. Often TCP and IP are quoted together as TCP/IP. This quotation actually refers to communication of these two protocols. The TCP and IP are two separate protocols operating at different TCP model layers and OSI levels. 
Learn more about different protocols in TCP/IP stack and OSI model architecture from the following tutorial - 
TCP/IP is communication of the two separate protocols - Transmission control Protocol and Internet Protocol. The Internet protocol standard defines the behavior of the packet i.e. it commands packets where to go and how to get there. The Transmission Control Protocol is responsible for synchronous and reliable data transmission over Internet connected Networks. Reliability comes because TCP supports error checking mechanism. The TCP continuously checks the transmitted and received data and if there is any loss in data or manipulation in data occurs, it retransmits the data back. The TCP is a connection-oriented protocol, which means a connection is established and maintained until client and server have finished exchanging the data to each other. Whenever any message/data is sent via TCP/IP protocol, the transmitter gets proper acknowledgement whether the packet is being delivered or not. 
The TCP/IP stack has the following features - 
TCP guarantees the ordered data delivery by acknowledgment function.
Retransmission of lost packets.
TCP helps to control traffic on the Internet.
It is best suited whenever a program wants to send a lot of data because TCP does fragmentation of data and sends it in the form of small packets. 
It supports error control and flow control.
It supports Multiplexing and De-multiplexing of data.
It allows to work over heterogeneous networks.
Basic operations under TCP/IP protocol 
The basic operations that are executed under TCP/IP protocol are as defined below -
1) Reliable Transmission - TCP uses a sequence number to identify each byte of data. Whenever the sender sends the data in the form of bytes, the sequence number is appended as the bytes are received and acknowledgement is sent to the sender with that sequence number to overcome the problem of packet reordering or packet loss. If any packet is not properly acknowledged, the sender again retransmits the data.
2) DupACK Based Retransmission - If the sender receives three or more duplicate packets in its acknowledgement, it retransmits that particular packet again. This greatly improves the reliability of data.
3) Timeout Based Retransmission - When sender transmits the packet, it set the timer at its end for getting the proper acknowledgment. It waits for that time, if it doesn’t get expected acknowledgement within that interval, it assumes that the packet has been lost and it transmits that packet again. 
4) Error Detection - TCP uses checksum mechanism to assure the correctness of data. The Checksum assures that the data which is being sent by the sender has been received by the receiver with no data manipulation.
5) Flow Control - It limits the rate at which sender is transmitting the data to guarantee reliable data delivery. The receiver continuously indicates the sender on how much data has been received and at what rate it is receiving.
6) Congestion Control - TCP uses a congestion window in the sender side to do congestion avoidance (traffic avoidance). The congestion window indicates the maximum amount of data that can be sent out on a connection without being acknowledged. TCP detects the congestion whenever it does not get the acknowledgement of data in the settable time interval.
The TCP/IP Protocol offers the following advantages - 
If there is need of reliable transmission, synchronization and no packet loss data, then TCP/IP protocol should be preferred.
It automatically breaks up the data into packets.
It supports a number of routing protocols.
It is connection oriented client-server architecture which means that connection will be established first before data can flow across the network.
However, TCP/IP also has some limitations as follow - 
It is complex to setup and manage.
It is not best suited for IoT applications as it has more overhead comparison with other protocols. 
It is slower protocol for continuous data streaming. 
Despite certain limitations, the TCP/IP protocol is a popular internet protocol and can be used by IoT devices to connect with a cloud platform. In the next tutorial - TCP/IP based IoT Communication with ThingSpeak Platform, an IOT device will be designed which could publish data to ThingSpeak Platform using TCP/IP protocol.  


Interesting read.