+;; Network
+
+(define (start-network-listener)
+ (thread-start!
+ (lambda ()
+ (let ((s (udp-open-socket*)))
+ (udp-bind! s #f this-port)
+ (let loop ()
+ (let-values (((n str) (udp-recv s 1024)))
+ (print "Received " n " bytes over network: " str)
+ (match (with-input-from-string str read)
+ ((uri-str message ...)
+ (apply send-message (cons (uri-reference uri-str) message)))
+ (else
+ (print "Warning: received badly formatted message string '" str "'"))))
+ (loop))))))
+