Version 3 of 8-Line Server

Updated 2009-05-28 20:08:02 by jdp

jdp - An 8 line server. Serves text files out of the current directory.

proc s {c a p} {
        set o [lindex [split [gets $c] " "] 1]
        puts $c [read [set f [open ".$o"]]]
        close $f
        close $c
}
set s [socket -server s 3210]
vwait forever

jdp - After spending time in the chatroom, with the help of stu and suchenwi, it became a 1-line, 140-char server. (Interactive mode only, though.)

vw [soc -server {appl {{c a p} {puts $c [read [set f [open .[regsub {\.\.+} [lindex [split [gets $c] \ ] 1] x]]]][close $f];close $c}}} 80]

enter categories here