I'm having a problem using fcopy. I'm just reusing code that has been working fine for transfer .pgm and .zip files for a long time. For this 2 ext, although they are binary files, I use -translation lf.
Now, I need to transfer an executable ( 7za.exe -from the 7z GNU project-). The file doesn't transfer properly (get corrupted and doesn't execute). I tried with -translation binary; and combinations of lf and crlf according to the 'in' and 'out' for each side, with no luck (although I can see the size of the file transferred change, the size sent by the server is always the same and identical to the size of the file storage in teh server)

below is the working code for .pgm and .zip files.
I'd appreciate any help, either to make it work or another way of transfering the file automatically if needed by the client

thanks,
Sergio


on the client side (OS: W2K)

if { ![ file exists $unzipper ] } {
    set serverpath $config(raw)/7za.exe
    set out [open $unzipper w+]
    ClientSend sendfile $serverpath    ; #send the command to the server
    set in $config(server)
    fconfigure $in -translation lf
    fconfigure $out -translation lf
    fcopy $in $out
    close $in
    close $out
    }
####################################  
on the server side (OS: Unix)
 
proc SendFile { filename } {
 global server
 global total
 set in [open $filename]
 set out $server(client)
 fconfigure $in -translation lf
 fconfigure $out -translation lf
 fcopy $in $out -command [list CleanPort $in $out]
 vwait total
 return
}
proc CleanPort { in out bytes { error {} } } {
 global total
 set total $bytes
 close $in
 close $out
 puts "Transferred $total"
 if {[string length $error] != 0 } {
    puts "CleanPort fcopy error $error"
 }
 return
}