Posted to tcl by crshults at Tue Mar 17 18:29:29 GMT 2015view raw

  1. package require udp
  2.  
  3. set udp_socket [udp_open 15351 reuse]
  4. chan configure $udp_socket -blocking 0 -buffering none -mcastadd {224.0.0.251} -mcastloop 1 -remote {224.0.0.251 15351}
  5.  
  6. proc read_data {} {
  7. puts [chan read $::udp_socket]
  8. }
  9.  
  10. chan event $udp_socket readable read_data
  11.  
  12. proc send_ping {} {
  13. chan puts -nonewline $::udp_socket ping
  14. }
  15.