Posted to tcl by patthoyts at Wed Mar 18 01:28:07 GMT 2009view pretty
package require udp proc Read {sock} { set data [read $sock] puts "recv [fconfigure $sock -peer]: [string length $data] '$data'" } set sock [udp_open 6969] fconfigure $sock -blocking 0 -buffering none -translation binary fileevent $sock readable [list Read $sock] # Sending using the tcludp demo app: # tclsh udpcat.tcl send localhost 6969 PING # this prints: # recv 127.0.0.1 52259: 4 'PING'