(import scheme) (import (chicken base)) (import srfi-1) (import srfi-13) (import socket) (import (chicken process-context)) (define broadcast-socket #f) (define bind-address (inet-address "0.0.0.0" #f)) (define broadcast-address (inet-address "255.255.255.255" 3742)) (define (broadcast-setup) (set! broadcast-socket (socket af/inet sock/dgram)) (set! (so-broadcast? broadcast-socket) #t) (socket-bind broadcast-socket bind-address)) (define (broadcast-send str) (socket-send-to broadcast-socket str broadcast-address)) (define (main) (let ((args (drop (argv) 1))) (if (null? args) (begin (display "usage: net-notify ") (newline)) (begin (broadcast-setup) (broadcast-send (string-concatenate (intersperse (cons "net-notify:" args) " "))))))) (main)