hope this is what u mean cause don't understand exactly what u are saying..
that string will set sock as variable and if the variable matches sock?? well then u connected other wize u didn't
Code: Select all
if {[string match -nocase sock?? $sock]} { .. } else { .. }
and so on ..
note: you can write ur data to $sock once u connected use
Code: Select all
fconfigure $sock -blocking 0 -buffering line
to make it non blocking well at least thats what i do

if its the right way .. don't know but it works or use flush..