← Back to the chapter · Previous detail

Technical detail · Choosing a Programming Language

Minimal Socket Boundary

Imagine sending one timestamped temperature record from a device-side script to a lab server. Connection success tells you the endpoint was reachable. It does not show that the server understood the timestamp, accepted the unit, or stored the row where the plotting script expects it.

Define a known record and inspect it at both ends. Compare the sent fields with the received and stored fields, then repeat with unavailable-server and malformed-record cases. Keep connection errors distinct from rejected application data. This avoids a common leap from “bytes arrived” to “the reading was delivered correctly.” The minimal sequence described here establishes the transport boundary; the record comparison supplies the additional evidence needed for the remote-logging claim.

Python’s socket interface exposes both connection-oriented and connectionless network paths. A minimal TCP server creates an Internet stream socket, binds it to an address and port, listens, accepts one connection, receives data, and closes the socket. Its client creates the matching socket, connects to the server address, and sends data.

That sequence proves only a narrow boundary: a client reached a listening endpoint and bytes crossed the connection. Keep the address, port, socket family, socket type, received-data limit, close behavior, and error path visible before treating the exchange as application delivery.

← Back to the chapter · Previous detail