set Port 2021
set GnuTLS 1
+set ext ""
set fn [lindex $argv 0]
set size 0
if {($argc > 0) && [file exists $fn]} {
- set ext [file extension $fn]
+ set ext [string trimleft [file extension $fn] .]
set fd [open $fn {RDONLY BINARY}]
set size [file size $fn]
} else {
set sock [socket $Host $Port]
chan configure $sock -encoding binary -translation binary
}
-puts -nonewline $sock "d"
-if {[info exists ext]} {
- set ext [string trimleft $ext .]
- puts -nonewline $sock [string cat "1:e" [string length $ext] ":$ext"]
-}
-puts -nonewline $sock "1:v$size:"
+
+puts -nonewline $sock [string cat [string length $ext] ":$ext,"]
+puts -nonewline $sock "$size:"
if {[info exists fd]} {
fcopy $fd $sock
close $fd
} {
puts -nonewline $sock $data
}
-puts -nonewline $sock "e"
+puts -nonewline $sock ","
flush $sock
while {[gets $sock line] >= 0} { puts $line }
close $sock