I'd however speculate that the problem is with using [vwait] - inside wish/tclsh you don't have to bother about giving a chance to eggdrop handlers to process IRC events - and inside eggdrop you naturally must do that, otherwise the bot will hang and ping timeout
so if you want a TCP (probably HTTP) server to run on eggdrop, you better use eggdrop's [listen] and [control] procs
I've think the same about vwait, so i've look the code, but the library dosen't contain any vwait command becouse the httpd server must be used in an application, for example using Tk, so it doesn't need vwait !
I don't like the listen/control procs becouse you can't scecify ip or configure the socket (blocking, buffer, etc...)
I can't believe there's no [vwait] in that code - you must somehow enter TCL's event loop to be able to process incoming connections - and the only way to do that from a script is to use [vwait]; in a C app, you'd use Tcl_DoOneEvent() - like eggdrop does in its event loop
and there's no need to configure the socket when using eggdrop's listen/control procs - all I/O in eggdrop is asynchronous (non-blocking) and buffered
1) use the script directly under Eggdrop (http://shell2.akseo.net:8888 to see the result with lag)
2) use the exec command to invoke tclsh on a script that starts the httpd (with teh same package) and there is no lag !
I think Eggdrop should force the use of certain values with fconfigure as -bufferring none !
you don't understand what i'm explaining becouse i'm bad in english, i'm not a newbie and i know very well what Eggdrop is and what a tcl script is.
I tell you that when i use mkHttpd not with Eggdrop, but whith tclsh directly there is no lag whereas when a use mkHttpd in an Eggdrop script there is a lag !
For example when i create a socket i do a fileevent on the sockid to call a proc when it is readable, but i must use vwait to enter Tcl Event loop !
If i don't the script will terminate, in the case of a socket i use a variable name that is never fixed to loop forever.
When i use Tcl in Eggdrop, i don't need vwait becouse Eggdrop have his proper event loop !
dude, eggdrop has many other things to do besides (occasionally) invoking Tcl_DoOneEvent() - whereas [vwait] in your tclsh script doesn't do anything else but looping/waiting on Tcl_DoOneEvent() (see Tcl sources if you know C)
so, if your eggdrop is busy serving what it was meant to serve - IRC channels - it would naturally be slower in serving HTTP requests via your extension - slower than your dedicated tclsh script which doesn't do anything else
example: I have a port checking script which waits for 2 fileevents (first: writeable and then readable). even it just opens a port , sends "\n" and closes it again (which needs about 150ms in blocking mode) it takes about 1500-2000ms, because fileevent triggers very slow. So probably the socket trigger isnt triggered much faster . Personally I always had the feeling that eggdrop waits a bit longer as necessary, probably it isn't running the main loop as fast as the cpu would allow, because it would increase the cpu usage too high ^-^.