Re: serving a file to a client --- background fcopy read fileevent event puts socket channel blocking nonblocking
- From: vitick@xxxxxxxxx
- Date: Sat, 29 Mar 2008 17:49:36 -0700 (PDT)
On Mar 29, 4:08 pm, Alexandre Ferrieux <alexandre.ferri...@xxxxxxxxx>
wrote:
On Mar 29, 11:42 pm, vit...@xxxxxxxxx wrote:
while {$check} {
fcopy $in $out -command [list CopyMore $in $out $size] -size $size
}
vwait done
When I run it I get the following error: channel "file3" is busy
Well, maybe you could read that manpage once more :-)
When fcopy has a -command, it is *asynchronous*, which means:
- sets up internal fileevents and nonblocking modes
- (also prevents any further fileevents and IO on the two channels)
- returns immediately
Your [while] loop (which by the way at least two persons have asked
you to remove) then tries to repeatedly register that asynchronous
operation. Of course the [fcopy] here runs exactly twice: one which
works, and one which raises the "busy" error you reported.
What you want is rather:
proc StartOneChunk s {
fcopy -command CopyMore -size $s ...
}
# prime the pump, just once
StartOneChunk $size
proc CopyMore args {
if {finished} {set ::done 1;return}
StartOneChunk $::size
}
vwait done
-Alex
I was not trying to go back to the "while" loop :). It is the code
that started it all. I was just curious why it didn't work. The
process seemed to be very similar to the correct code (calling fcopy
repeatedly) and that's what made me confused. But your explanation
makes it clear.
Thanks,
----Victor
.
- References:
- serving a file to a client --- background fcopy read fileevent event puts socket channel blocking nonblocking
- From: vitick
- Re: serving a file to a client --- background fcopy read fileevent event puts socket channel blocking nonblocking
- From: Bruce Hartweg
- Re: serving a file to a client --- background fcopy read fileevent event puts socket channel blocking nonblocking
- From: vitick
- Re: serving a file to a client --- background fcopy read fileevent event puts socket channel blocking nonblocking
- From: vitick
- Re: serving a file to a client --- background fcopy read fileevent event puts socket channel blocking nonblocking
- From: Alan Anderson
- Re: serving a file to a client --- background fcopy read fileevent event puts socket channel blocking nonblocking
- From: vitick
- Re: serving a file to a client --- background fcopy read fileevent event puts socket channel blocking nonblocking
- From: Alexandre Ferrieux
- Re: serving a file to a client --- background fcopy read fileevent event puts socket channel blocking nonblocking
- From: vitick
- Re: serving a file to a client --- background fcopy read fileevent event puts socket channel blocking nonblocking
- From: Darren New
- Re: serving a file to a client --- background fcopy read fileevent event puts socket channel blocking nonblocking
- From: vitick
- Re: serving a file to a client --- background fcopy read fileevent event puts socket channel blocking nonblocking
- From: Alexandre Ferrieux
- serving a file to a client --- background fcopy read fileevent event puts socket channel blocking nonblocking
- Prev by Date: Re: serving a file to a client --- background fcopy read fileevent event puts socket channel blocking nonblocking
- Next by Date: Re: serving a file to a client --- background fcopy read fileevent event puts socket channel blocking nonblocking
- Previous by thread: Re: serving a file to a client --- background fcopy read fileevent event puts socket channel blocking nonblocking
- Next by thread: Re: serving a file to a client --- background fcopy read fileevent event puts socket channel blocking nonblocking
- Index(es):
Relevant Pages
|