tornado/demos/tcpecho
Ben Darnell b909d37e54 docs,demos: Update for asyncio.run pattern
Adapt for Python 3.10 deprecation changes by using asyncio.run
instead of IOLoop.start throughout (except for TCPServer multi-process
docs).

Demos have all been changed but I haven't tested all of them.
2022-06-03 14:50:20 -04:00
..
README.md Add suffix to README 2016-08-12 08:29:55 +02:00
client.py docs,demos: Update for asyncio.run pattern 2022-06-03 14:50:20 -04:00
server.py docs,demos: Update for asyncio.run pattern 2022-06-03 14:50:20 -04:00

README.md

TCP echo demo

This demo shows how to use Tornado's asynchronous TCP client and server by implementing handle_stream as a coroutine.

To run the server:

$ python server.py

The client will send the message given with the --message option (which defaults to "ping"), wait for a response, then quit. To run:

$ python client.py --message="your message here"

Alternatively, you can interactively send messages to the echo server with a telnet client. For example:

$ telnet localhost 9888
Trying ::1...
Connected to localhost.
Escape character is '^]'.
ping
ping