Write a TCP Client for a Telemetry Server
A TCP connection is a symmetric, bidirectional byte stream. Once it is established, either side can start sending data. The familiar "client sends a request, then the server replies" pattern is a convention of higher-level protocols, not a rule of TCP itself.
Some servers send data without waiting for a request at all: telemetry feeds,
market data tickers, and log tailers start pushing bytes the moment you
connect. A client for this kind of server needs only a minimal part of the
sockets workflow:
connect(), then recv() in a loop for as long as you want to keep reading.

Berkeley Sockets API cheat sheet.
The Task
A telemetry server is running on a separate host at 172.16.0.10:5000. As
soon as a client connects, it starts streaming sensor readings - one per line.
It never stops and never reads anything from the client.
Each reading looks like this:
sensor=reactor_core seq=1 temp_c=40.5 digest=9f3a1c0b7e2d4a85
sensor=reactor_core seq=2 temp_c=41.0 digest=2b8e07f1a4c9d36e
sensor=reactor_core seq=3 temp_c=41.5 digest=c0d51a9b3f7e8240
...
Your task is to write a client that captures the live telemetry stream:
- Connect to
172.16.0.10:5000from thedev-01machine. - Read everything the server sends and stream it into
~/telemetry.logas it arrives. - Keep reading until at least 50 data points have been captured.
You can use any language to write your client. The playground already has gcc (for C/C++), Python, Node.js, and Go installed. If you prefer a different stack, install it yourself.
No request needed. Unlike an echo server, this telemetry server never waits for client input to start replying.
Hint 1: The client-side workflow
A TCP client for a push-only server is short: create a socket, connect() it to the server's address
and port (172.16.0.10:5000), then read bytes. For this server there's nothing
to write - go straight to reading.
The How Servers Work tutorial walks through a minimal client in Python.
Hint 2: Streaming to a file as data arrives
A single recv() returns as soon as some bytes are available, which
is almost never the whole message - especially in this case, where
the server sends the readings with a delay between them.
Keep reading in a loop and emit each chunk as you get it rather than buffering the entire stream in memory - it's endless, so buffering the entire stream in memory won't really be possible.
Hint 3: Using tee to stream to a file
Instead of writing to a file from your client, you can simply
print the received data to stdout and let the shell do the file-writing
for you by piping the stdout to the tee command like this:
./client | tee ~/telemetry.log
It'll save you some keystrokes and keep your client code simple.