All pastes #67113 Raw Edit

Something

public text v1 · immutable
#67113 ·published 2006-06-19 11:39 UTC
rendered paste body
; this is to listen on port 123 for any connection and pass everything to the channel #file.lv
; will it work?

proc serverOpen {channel addr port} {
    fileevent $channel readable "readLine Server $channel"
}

proc readLine {who channel} {
    if {[gets $channel line]<0} {

            ;what do the following two lines do?

            fileevent $channel readable {}
            after idle "close $channel;set out 1"
    } else {        
            putquick "PRIVMSG #file.lv : $line"
            flush $channel;
    }
}

# catch {socket -server serverOpen 123} server
set server [socket -server serverOpen 123]