Skip to content
Branch: master
Find file History
Type Name Latest commit message Commit time
Failed to load latest commit information. Add suffix to README Aug 12, 2016 *: Remove Python2 __future__ imports throughout the codebase Jul 14, 2018 make executable bit and shebang consistent on various source files Jan 7, 2018

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

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

$ python --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 '^]'.
You can’t perform that action at this time.