Updated 2012-03-31 21:17:32 by dkf

Whatever workarounds ppl on fora have or however you wanna say it better, it comes down to the fact that the TCL socket -server command fails.

Sockets block totally from doing anything after a while, so a tcl prog would easily be DDOSed by a single ip.

Appearantly it's been going on like that since version 8.4.1. and now 8.5.2. does still pretty much the same.

I hate to say it as tcl was always an extension for me, and it's the only language i can program in, but due to this it isn't really much more as a scripting language..

AMG: Try nonblocking I/O. Many pure-Tcl web servers exist. I know, I wrote one of them. It can handle multiple clients simultaneously. The trick is in how you write your [socket -server] callback procedure. It should initialize a few things then get out of the way, returning to the event loop; it should not do any potentially blocking I/O of its own. Of course, it will need to do some I/O, but it should go through the nonblocking mechanisms. That means [fconfigure]'ing the socket to have -blocking 0, then using [fileevent] to schedule another callback for handling incoming data. The same goes for the [fileevent] callback: use only nonblocking I/O.

If you've tried all that and still have trouble, please post a small code example showing the problem.

DKF: Googling finds good instructions as the top hit. Even the puts page here talks about non-blocking IO. To conclude that Tcl doesn't support it… smells like either very poor research, or trolling.