@@ -836,19 +836,25 @@ Networking with Trio
836836Now let's take what we've learned and use it to do some I/O, which is
837837where async/await really shines.
838838
839-
840- An echo client
841- ~~~~~~~~~~~~~~
842-
843- The traditional application for demonstrating network APIs is an "echo
844- server": a program that accepts arbitrary data from a client, and then
845- sends that same data right back. (Probably a more relevant example
839+ The traditional toy application for demonstrating network APIs is an
840+ "echo server": a program that awaits arbitrary data from remote clients,
841+ and then sends that same data right back. (Probably a more relevant example
846842these days would be an application that does lots of concurrent HTTP
847843requests, but for that `you need an HTTP library
848844<https://github.com/python-trio/trio/issues/236#issuecomment-310784001> `__
849845such as `asks <https://asks.readthedocs.io >`__, so we'll stick
850846with the echo server tradition.)
851847
848+ In this tutorial, we present both ends of the pipe: the client, and the
849+ server. The client periodically sends data to the server, and displays its
850+ answers. The server awaits connections; when a client connects, it recopies
851+ the received data back on the pipe.
852+
853+
854+ An echo client
855+ ~~~~~~~~~~~~~~
856+
857+
852858To start with, here's an example echo *client *, i.e., the program that
853859will send some data at our echo server and get responses back:
854860
@@ -857,6 +863,9 @@ will send some data at our echo server and get responses back:
857863.. literalinclude :: tutorial/echo-client.py
858864 :linenos:
859865
866+ Note that this code will not work without a TCP server listening at
867+ ``127.0.0.1:12345 ``.
868+
860869The overall structure here should be familiar, because it's just like
861870our :ref: `last example <tutorial-example-tasks-intro >`: we have a
862871parent task, which spawns two child tasks to do the actual work, and
0 commit comments