IoT: Choosing Between UDP, TCP, Modbus, and the Dwindling IPv4 Era

IoT: Choosing Between UDP, TCP, Modbus, and the Dwindling IPv4 Era

Introduction

In the world of the Internet of Things (IoT), the communication method is the “soul dialogue” between devices.

The choice of which “language” you use often directly determines whether they work in harmony or talk past each other.

IoT communication can actually be viewed from two levels:Physical Layer and Application Layer.

The previous section covered the physical layer, and this chapter introduces the application layer.

Common IoT application layer protocols include:

MQTT (Lightweight Message Queuing Protocol)

CoAP (HTTP-like protocol for constrained devices)

HTTP/HTTPS (General web communication protocol)

Modbus, OPC UA (Commonly used in industrial fields)

Below the application layer, it typically relies on Transport Layer Protocols (TCP or UDP) to complete data transmission.

IoT: Choosing Between UDP, TCP, Modbus, and the Dwindling IPv4 Era

Key Fog – UDP vs TCP

IoT: Choosing Between UDP, TCP, Modbus, and the Dwindling IPv4 EraIoT: Choosing Between UDP, TCP, Modbus, and the Dwindling IPv4 Era

In simple terms: in situations with low transmission volume, such as SCADA.

IP may conflict with the host computer, but data collection is still needed; in this case, we use UDP to collect data using different protocols on the same IP.

For example: A company has a CNC machine with a host computer, IP address: 192.168.1.110. If the collection cannot change the address as it would affect the host computer, then UDP communication is used for 192.168.1.110.

Now let’s discuss the differences between the two:

Comparison Dimension TCP UDP
Connection Method Connection-oriented (establishes a three-way handshake) Connectionless (sends data directly)
Reliability Has acknowledgment mechanism, packet retransmission, guarantees order Does not guarantee reliability, does not guarantee order
Transmission Speed Relatively slow (requires acknowledgment and retransmission) Faster (sends and forgets)
Overhead Large (header 20 bytes) Small (header 8 bytes)
Applicable Scenarios File transfer, HTTP, database communication Real-time audio/video, IoT sensor data reporting, gaming

IoT: Choosing Between UDP, TCP, Modbus, and the Dwindling IPv4 Era

MQTT

MQTT (Message Queuing Telemetry Transport) is a lightweight publish/subscribe (Pub/Sub) messaging protocol based on TCP/IP, designed for low-bandwidth, unstable network environments.

Features

  • Very small protocol header (minimum 2 bytes), low transmission overhead

  • Uses a publish/subscribe model, supports one-to-many communication

  • Supports QoS (Quality of Service) levels: 0 (best effort), 1 (at least once), 2 (exactly once)

  • Has persistent sessions and offline message capabilities

Advantages

  • Saves bandwidth, suitable for IoT terminals

  • Easy to penetrate firewalls and NAT

  • Good real-time performance (seconds or even milliseconds)

Disadvantages

  • Based on TCP, connection maintenance requires heartbeat packets

  • Not suitable for large file transfers

Typical Applications

  • Smart home device interconnection (lighting control, sensors)

  • Industrial IoT device status monitoring

  • Vehicle networking data upload

IoT: Choosing Between UDP, TCP, Modbus, and the Dwindling IPv4 EraIoT: Choosing Between UDP, TCP, Modbus, and the Dwindling IPv4 Era

CoAP

CoAP (Constrained Application Protocol) is an application layer protocol for resource-constrained devices, based on UDP, and structurally similar to HTTP but lighter.

Features

  • Uses HTTP-like GET, POST, PUT, DELETE methods

  • Based on UDP, supports multicast

  • Supports Resource Discovery

  • Small message size, suitable for low-power networks (e.g., LoRa, NB-IoT)

Advantages

  • Simplified protocol, low power consumption

  • Still usable in low-bandwidth, high-latency networks

  • Supports DTLS encryption

Disadvantages

  • Based on UDP, transmission is unreliable and requires additional mechanisms to ensure reliability

  • Lower popularity than HTTP

Typical Applications

  • Sensor networks

  • Smart meter reading

  • NB-IoT environmental monitoring nodes

IoT: Choosing Between UDP, TCP, Modbus, and the Dwindling IPv4 EraIoT: Choosing Between UDP, TCP, Modbus, and the Dwindling IPv4 Era

HTTP / HTTPS

HTTP (HyperText Transfer Protocol) is the most commonly used client-server communication protocol globally, while HTTPS is its secure version (HTTP with TLS/SSL encryption).

Features

  • Based on TCP (ports 80/443)

  • Request/Response model

  • HTTPS provides encryption, tamper-proofing, and authentication

Advantages

  • Globally universal, highly compatible

  • Easy to integrate with web services and apps

  • Low barrier to entry for engineers

Disadvantages

  • Relatively high overhead, not suitable for low-power terminals with continuous long connections

  • Higher latency than MQTT/CoAP

Typical Applications

  • Device web API interfaces

  • OTA firmware upgrades

  • Data reporting to cloud platforms

IoT: Choosing Between UDP, TCP, Modbus, and the Dwindling IPv4 EraIoT: Choosing Between UDP, TCP, Modbus, and the Dwindling IPv4 Era

Modbus / OPC UA

Modbus

  • Definition: An established industrial serial communication protocol that supports RTU (serial) and TCP (Ethernet) modes

  • Features: Simple structure, master-slave mode, easy to implement

  • Advantages: Stable, low implementation cost, widely supported

  • Disadvantages: Simple data structure, does not support complex data types

  • Applications: PLC control, instrument monitoring, energy management systems

OPC UA

  • Definition: A next-generation industrial automation communication standard, service-oriented architecture, cross-platform, cross-system

  • Features: Supports complex data models, strong security (encryption, authentication)

  • Advantages: Scalable, suitable for Industry 4.0, supports cloud connectivity

  • Disadvantages: Complex implementation, higher hardware requirements

  • Applications: Large industrial SCADA systems, cross-plant data integration

IoT: Choosing Between UDP, TCP, Modbus, and the Dwindling IPv4 EraIoT: Choosing Between UDP, TCP, Modbus, and the Dwindling IPv4 Era

Click the blue text to follow us

Leave a Comment