Building an Echo Server Using Tornado(superjared.com)
superjared.com
Building an Echo Server Using Tornado
http://superjared.com/entry/building-echo-server-using-tornado/
4 comments
Echo Server in Twisted Matrix:
Exactly, thanks for posting this (you beat me to it).
It's not that we need to constantly respond to every Tornado post with a Twisted rebuttal - but it is appropriate to respond to articles the contain FUD and demonstrate far less elegant, far more verbose, non cross-platform solutions.
It's not that we need to constantly respond to every Tornado post with a Twisted rebuttal - but it is appropriate to respond to articles the contain FUD and demonstrate far less elegant, far more verbose, non cross-platform solutions.
[deleted]
Yet, it is just nice seeing how tornado can be re-used outside the core web development.
Echo Server in Eventlet (http://eventlet.net/):
from eventlet import api
def handle_socket(address):
sock, ip = address
while True:
sock.send(sock.recv(1))
api.tcp_server(api.tcp_listener(('0.0.0.0', 6000)), handle_socket)Echo server in 10-years old Tcl (more?):
p.s. note the poetry contained in the "vwait forever" statement ;) Our program is willing to run without stop until the end of the universe.
socket -server acceptConnections 9999
proc acceptConnections {fd clientaddr clientport} {
fconfigure $fd -blocking 0
fileevent $fd readable [list replyToClient $fd]
}
proc replyToClient fd {
set s [read $fd]
puts -nonewline $fd $s
flush $fd
}
vwait forever
Note that this is a multiplexing non blocking server, exactly like Twisted / Tornado. All features built-in in the language. Tcl failed copying the obvious missing features from other languages. Other languages are failing copying the good things from Tcl.p.s. note the poetry contained in the "vwait forever" statement ;) Our program is willing to run without stop until the end of the universe.
Tornados are dangerous, but I'm glad you're eager to serve their echos.
this is a nice joke.
wondering why do hackers vote that down