Re: serving a file to a client --- background fcopy read fileevent event puts socket channel blocking nonblocking



On Mar 28, 5:32 pm, Alan Anderson <arand...@xxxxxxxxxxxxx> wrote:
In article
<3c69be6e-ce92-4f23-9103-48da5f1fb...@xxxxxxxxxxxxxxxxxxxxxxxxxxx>,

vit...@xxxxxxxxx wrote:
It looks like the only way to reliably do what I was trying to do is
to learn the Threads extension of TCL.

May I propose a better way? Learn how to work *with* the event loop
rather than fighting it. Start small. Try doing one thing, and post
here your solution. If feedback from some of the more experienced folk
here is positive, add one more thing, post here, repeat.

Based on the code you posted already, it's likely that feedback will
take the form of constructive suggestions on what to change in order to
make it work better. For example, I can think of no good reason *ever*
to write an infinite loop in an interactive Tcl application. I think
you might find that there is a teeny bit of misunderstanding on your
part regarding the "proper" way to do event-driven programming.

Thanks Alan,

First of all, I had an infinite loop example to simulate a long
running procedure.
I have never so far written an actual infinite loop proc, I would at
least have
a break out code if I had written one.

But, nevertheless, lets attempt to go after a solution that does not
use threads.
How do you write a file to socket copy procedure that notifies me
about it's progress
every so many bytes and does not block while doing so. How about if I
want to control how fast
the copy progresses without blocking other events? Or, lets say,
theoretically, that I want
to stream a music or a video file where the user can fast forward and
go back, without
blocking and without sending the entire file over. And also, how about
a long running
procedure that doesn't block?

Thanks
Those are just theoretical questions that need generic answers.

Thanks
.



Relevant Pages

  • Re: Sorry, but need more help
    ... >> I tried the code below in a loop calling it. ... > most often refers to a tcl program running in the tcl web browser ... window with that data and have it stay on top and display the changes as the ... > load in the showMessage proc definition with a timeout of 10000 ...
    (comp.lang.tcl)
  • Re: Efficient looping
    ... >> I am writing some numerical processing procedures using Tcl. ... > statement in the loop then run each loop and see which one goes faster: ... of processing in the actual loops and the data access patterns ...
    (comp.lang.tcl)
  • Re: tcl/expect locked up
    ... >> files and then CLI dumping each log file to confirm the contents. ... >> worked around by dumping the logs after the loop (which is sufficient ... >> buffering constraint inherent to TCL/Expect. ... > Tcl and expect are rock solid and have no known buffering constraints. ...
    (comp.lang.tcl)
  • tcl with non-tk ( qt / gtk+ )
    ... I need an interactive interpreter + GUI ... I may need to pass 100,000 c data to the tcl interpreter ... So what I want is tcl and gtk+ ... i.e. tcl is in the outer loop, when the user is using the GUI (click, ...
    (comp.lang.tcl)
  • Re: non-modal file save dialog
    ... If you can get everything into one loop it can help ... (and being "at the mercy of Tk event mechanism" ... > different topic (an a doable one in our application and how it uses Tcl). ... As the vehicle containing the application travels, this map is kept ...
    (comp.lang.tcl)