VERIFIED LOCAL EXCHANGE / FICTIONAL ROBOT
AMR Socket Lab.
A working Python TCP client and server, a real localhost message exchange, and an iPhone-friendly interactive visualization. The engineering question: when TCP acknowledges bytes, who confirms the application processed them?
Explore the exchange.
The browser demonstration visualizes what happens during a TCP connection and message exchange. It's a teaching simulation, not a raw-socket application; the downloadable Python source contains the actual working client and server.
The question behind the lab.
Calling sendall() can successfully submit bytes to TCP even though the destination process hasn't parsed, validated, persisted or accepted the message yet. TCP's acknowledgments are transport events. Application acceptance is a different event, and it must be defined by the application.
Transport reliability is not the same as application acceptance.
Two processes. One TCP connection.
The server binds to 127.0.0.1:12000 in its normal run, calls listen(), then obtains a connected socket from accept(). The client calls connect(), and the operating system handles TCP's connection establishment.
# Simplified TCP server flow
server.bind(("127.0.0.1", 12000))
server.listen(1)
connection, address = server.accept()
# A newline terminates each JSON message.
# TCP itself does not preserve message boundaries.The fictional client submits a JSON robot-status record. The server reads bytes until the newline delimiter, parses the record, and returns a distinct application-level status acknowledgment.
What the test actually demonstrates.
The archived automated test logs a real localhost TCP exchange between separate Python processes using an OS-assigned test port. The server accepted the connection, received robot_status, and returned status_ack.
SERVER received application message:
{'type': 'robot_status',
'robot_id': 'AMR-01',
'status': 'mission_complete'}
SERVER sent application response:
{'type': 'status_ack',
'robot_id': 'AMR-01',
'received_status': 'mission_complete',
'accepted': True}
RESULT: SUCCESS — local TCP exchange confirmed.Confirmed: Local socket connection and application response. Not yet demonstrated: Multi-host routing, packet captures, TLS, UDP, or real robot integration.
What to break next.
The next experiments intentionally stop the server, mismatch the destination port, and inspect the TCP handshake. Then we'll extend into the larger Packet Journey Lab: real routed Linux hosts, DNS, UDP, TLS, and failure investigation.