Name the phase that expired
The lab client connects, sends STATUS 42 and the server reads the request. Only then does the client wait for a response with a 150 ms timeout. Because the runner has not sent a response yet, recv raises TimeoutError. The connection was already established and the server application had read the request. Classifying this result as DNS or handshake failure loses essential information. During an incident, record the failed call, configured value, observed elapsed time, source and destination and business identity. A generic network timeout message is not a root cause.
A response can arrive later
After observing the timeout, the runner sends READY 42 and the client receives it on the same socket without reconnecting. The experiment demonstrates a controlled sequence, not a guarantee about every library or service. Some applications close the resource or cancel tasks under their own policy. The team must distinguish the local deadline, possible cancellation propagation and remote outcome. The 150 ms value is not the TCP RTO either: the API limit and retransmission timer are separate mechanisms. This experiment captures no retransmissions and does not measure the system RTO algorithm.
Explicit refusal with bounded context
To observe refusal, the runner reserves a local port, closes that socket and connects to the address just released. Execution returned ECONNREFUSED. The code checks the result instead of assuming it because the port is no longer reserved during that interval. There was no capture attributing packets to external components. In production, the same error class requires address, port, source, time and authorized path observations. A missing listener, a rejection policy and the wrong context cannot be distinguished solely from the word refused shown to a user.
A datagram tail does not remain pending
The sender sends datagram abcdefghij followed by NEXT. The receiver calls recvmsg with room for four bytes and receives abcd with MSG_TRUNC. The next read returns NEXT, not efghij. The application must observe truncation and apply its contract for incomplete events. In a fictional collector, storing the prefix as a valid event can produce incorrect metrics. Align the sender limit, protocol message allowance and receive capacity. Increasing the next buffer does not recover an already discarded tail, and concatenating datagrams with different identities corrupts their meaning.
Empty depends on the socket type
Another experiment sends a zero-length UDP datagram followed by AFTER EMPTY. recvfrom returns empty bytes with the sender address and then receives the next datagram. That is not TCP-stream EOF. The application may reject empty messages, but it should do so under a protocol rule rather than inventing connection closure. The experiment is local and does not measure UDP delivery across a WAN, loss, ordering or IP fragmentation. For a real protocol, review size, identity and loss recovery without assuming guarantees from a different transport.
Give RUN a reproducible decision
For the fictional settlement case, report that reading timed out and that the remote outcome still needs lookup. Retain the original identity when applying the deduplication contract; a new identity may represent another intent. The evidence package includes phase, timeline, error, version and the business success criterion. The executed runtime was Python 3.13.1 on macOS; the consulted 3.13 documentation displays 3.13.16. All eight experiments use IPv4 loopback without TLS, DNS, capture or financial effects. Target-environment acceptance still requires its actual path and dependencies.
The timeout occurred after the server read STATUS 42. READY 42 arrived later on the same socket. In another experiment, MSG_TRUNC identified a discarded tail and the next receive returned a different datagram.
Common pitfalls
Calling a read timeout a handshake failure; inferring RTO from the API; assuming remote cancellation; concatenating datagrams; treating empty UDP as EOF; extrapolating loopback to international availability.
Related topics: Transport, acknowledgement, and messages · States, queues, and flow control · Diagnosis in the application context
Locate the wait and the contract before retrying. The technical error guides investigation; identity and application state guide recovery without duplicate effects.
Reference: Python socket interface · BigSavant TCP/IP 2026-09; TCP RFC 9293; IPv6 RFC 8200 with RFC 9673 update; Linux socket and iproute2 guidance