Updated 2014-11-12 20:15:12 by dkf

fcopy inchan outchan ?-size size? ?-command callback?

fcopy provides the developer the ability to copy data from an input channel to an output channel, either synchronously or in the background, using fileevents to schedule activity.

For copying a file from one place in a filesystem to another see also file copy.

LV Does anyone have some sample code to demonstrate some tcl best practices concerning writing async code using fcopy to copy files ? Maybe for instance the example could loop through 3 machines doing an fcopy of a file like /tmp/motd?

What I'm after is some examples of the type of code doing error checking for things like machines not available, out of disk space, etc - all the sort of things that if one is trying to write a 'safe' application one would do.

LV In April, 2005, on comp.lang.tcl, a thread titled fcopy problem was discussing problems using fcopy on large binary files between channels. The fcopy appeared to be losing bytes.

The original poster was using -encoding binary, because the documentation said that this will then assign no interpretation to the data in the file and simply read or write raw bytes. However, DKF suggested changing to use -translation binary instead. The original poster followed up that making that change indeed sorted out his problem.

dzach 2006-5-8 Hmm... After spending a day trying to make a bidirectional copy between two open sockets, I wonder if something like fcopy sock1 sock2 -bidirectional 1 -command script is possible with fcopy as it stands today.

So, a day later, here is fconnect, kind of a bidirectional fcopy.