Masterx831
public text v1 · immutable$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