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



On Mar 29, 2:23 pm, Darren New <d...@xxxxxxxxxx> wrote:
vit...@xxxxxxxxx wrote:
I am still not sure why my code did not work.

You would need to show the whole of the code, including where you wait
for file events and where you open and close the files. At what line
were you getting "file busy errors"?

--
Darren New / San Diego, CA, USA (PST)
"That's pretty. Where's that?"
"It's the Age of Channelwood."
"We should go there on vacation some time."

I deleted my original code, but this one does the same thing with the
same error:

set done 1

set in [open file1]
fconfigure $in -translation binary -encoding binary -blocking 0

set out [open file2 w]
fconfigure $out -translation binary -encoding binary -blocking 0

set check 1
set size 1024


while {$check} {
fcopy $in $out -command [list CopyMore $in $out $size] -size $size
}

proc CopyMore {in out size {error {}} } {
puts CallBack
if {[eof $in] || $error != "" } {set check 0; close $in}
}

vwait done


When I run it I get the following error: channel "file3" is busy
.



Relevant Pages