All pastes #1656320 Raw Edit

Masterx831

public text v1 · immutable
#1656320 ·published 2009-11-04 09:00 UTC
rendered paste body
$argc <= 1} {<dstaddr>}
 
set dstaddr [lindex $argv 0]
set dstport [lindex $argv 1]
set nick "tcl"
set ident "svs"
set gecos "tcl"
 
set fd [socket $dstaddr $dstport]
 
puts $fd "NICK $nick"
flush $fd
puts $fd "USER $ident \"\" \"\" :$gecos"
flush $fd
 
while {[set in [gets $fd]] != -1} {
   if {[regexp -nocase {^PING (:[^ ]+)$} $in regex match]} {
      puts $fd "PONG $match"
      flush $fd
   }
   puts stdout $in
}
 
close $fd