TransmitFile

http://msdn.microsoft.com/library/en-us/winsock/winsock/transmitfile_2.asp

# tcl code snippet
proc putfile {port filename} {
    set size [file size $filename]
    set fp [open $filename]
    fconfigure $fp -translation binary
    set channel [socket $::dsclient::server $port]
    fconfigure $channel -translation binary
    puts $channel [list $filename $size $port]
    fcopy $fp $channel -size $size
    close $fp
    close $channel
}