Designing reliable network communication into a controller or other embedded device starts with understanding how data moves through the network stack. TCP/IP for embedded systems is not a single protocol: it is a layered set of protocols that connects application software to network hardware. For automation engineers and system integrators, understanding those layers helps with device configuration, troubleshooting, and choosing how an application should exchange data.
This guide follows a message from its network connection to the protocols that deliver it to an application. It also outlines the addressing and configuration decisions required to connect an embedded host to a local network or remote system.
How Ethernet carries network traffic
TCP/IP is designed to work across different physical network technologies. Ethernet is one common way to carry IP traffic. At the Ethernet level, data is organized into frames, which include source and destination hardware addresses, a type field, payload data, and an error-checking trailer. The destination address helps determine which interface should process a frame on the local network.
Each Ethernet interface has a 48-bit Media Access Control (MAC) address. This is distinct from an IP address: the MAC address identifies an interface at the data-link level, while the IP address provides the addressing used to move packets between networks. When an IP packet needs to be sent over Ethernet, the sender must identify the appropriate local MAC address. The Address Resolution Protocol (ARP) does this by broadcasting a request on the local network and receiving a response from the host whose IP address matches.
Ethernet networks can connect devices through shared or switched infrastructure. Repeaters extend a signal between network segments, while bridges examine frames and can filter or forward them between LAN segments. For an embedded device, the important point is that Ethernet provides the local link; it does not by itself determine how traffic reaches a different IP network.
IP addressing and routing
The Internet Protocol (IP) provides addressing and packet delivery between hosts, including hosts on different kinds of networks. Each IP packet carries source and destination IP addresses. Unlike TCP, IP is connectionless: it does not establish a session before sending each packet, and it does not guarantee delivery. If an application needs reliable delivery, that responsibility belongs to a higher-level protocol such as TCP.
An IP address and a netmask together identify which part of an address refers to the network and which part identifies a host or subnet. Devices on the same subnet can communicate over the local network. To reach a remote network, a host uses a routing table. If no more specific route applies, the default route typically points to a router or gateway that can forward the packet onward.
Routers examine destination addresses and consult routing tables to select the next destination for a packet. A packet may pass through multiple routers before reaching its final host. If a suitable route is not available, IP discards the datagram. IP also includes a Time to Live (TTL) field, which is reduced as a packet passes through routers; a packet is discarded if the TTL reaches zero.
Choosing TCP or UDP for an application
TCP and UDP are transport-layer protocols that provide different services to applications. Selecting between them depends on what the application needs from its communication path.
- TCP establishes a connection between two hosts and delivers a byte stream. It uses sequence numbers and acknowledgements to keep data in order and detect missing or incomplete delivery. TCP can retransmit data when needed and uses flow control to regulate how much data a receiver is prepared to accept.
- UDP sends independent datagrams without establishing a connection. It adds port-based delivery to applications and can include a checksum, but it does not provide TCP’s delivery guarantees or resequencing. UDP is also used where multicast or broadcast delivery is required.
A TCP connection is established through a three-way handshake. After setup, the connection is identified by the source and destination IP addresses and port numbers. Port numbers direct traffic to the appropriate application on a host. A server listens on a chosen port, while a client typically uses a temporary, or ephemeral, port for its session.
For an automation application, the protocol choice should follow the required behavior rather than habit. If the application needs an ordered, reliable stream, TCP provides mechanisms for that. If it exchanges independent datagrams or needs broadcast or multicast communication, UDP may be appropriate, with the application accounting for the delivery behavior it requires.
Configuration essentials for an embedded host
A host needs enough network configuration to communicate locally and reach other networks. With manual configuration, the essential values are the device’s IP address, its netmask, and the address of the default gateway. A DNS server address is needed when the device must resolve domain names. The network administrator determines the appropriate address plan and subnet configuration.
Alternatively, Dynamic Host Configuration Protocol (DHCP) allows a device to request configuration values from a DHCP server. In the implementation described by the source manual, DHCP can provide the IP address, netmask, gateway, and name server. Whether configuration is static or dynamic, the embedded application and the network environment must use compatible settings.
Buffer sizing is another implementation consideration. TCP read and write buffers and UDP datagram buffers consume device memory. Their sizes should be selected with the target platform and expected traffic in mind. In the documented Dynamic C implementation, buffer-size settings vary by software version, so engineers should consult the applicable library documentation rather than assume a setting has identical behavior across releases.
Use the layers to troubleshoot systematically
When communication fails, the layered model provides a useful diagnostic order. First check the physical connection and Ethernet link. Then verify local addressing and subnet settings, followed by gateway and routing information for remote destinations. ARP relates local IP addresses to Ethernet addresses, while ICMP tools such as ping can help determine whether an IP address is reachable. Finally, check whether the intended application is listening on the expected transport protocol and port.
This sequence separates link problems from addressing, routing, transport, and application issues. It also helps teams communicate clearly about where a fault appears instead of treating every network failure as an application problem.
Conclusion
Embedded TCP/IP communication depends on several cooperating layers: Ethernet moves frames across a local link, IP addresses and routes packets, and TCP or UDP provides transport services to applications. Correct device addressing, suitable transport selection, and deliberate buffer configuration are practical design responsibilities. Understanding these fundamentals gives automation teams a clearer basis for integrating connected devices and diagnosing network behavior.