Posted to tcl by crshults at Tue Sep 26 04:22:59 GMT 2017view pretty
# put this first block into a .tcl file and source into tclsh on the RPi: package require udp set sock [udp_open 15351 reuse] chan configure $sock -blocking 0 -buffering none -remote {255.255.255.255 15351} -broadcast 1 proc read_data {} {puts [chan read $::sock]} chan event $sock readable read_data chan puts -nonewline $sock "This is a UDP broadcast message." proc broadcast {} {chan puts -nonewline $::sock "I am a raspberry pie."; after 2000 broadcast} broadcast vwait forever # put this block into a .tcl file and source into tclsh on the Windows box: package require udp set sock [udp_open 15351 reuse] chan configure $sock -blocking 0 -buffering none -remote {255.255.255.255 15351} -broadcast 1 proc read_data {} {puts [chan read $::sock]} chan event $sock readable read_data chan puts -nonewline $sock "This is a UDP broadcast message." proc broadcast {} {chan puts -nonewline $::sock "I am a window."; after 2000 broadcast} broadcast vwait forever