syndicate-rkt/syndicate-examples/udp-echo.rkt

11 lines
327 B
Racket

#lang syndicate
(require/activate syndicate/drivers/udp)
(spawn (define s (udp-listener 5999))
(during s
(on (message (udp-packet $c s $body))
(printf "~a: ~v\n" c body)
(define reply (string->bytes/utf-8 (format "You said: ~a" body)))
(send! (udp-packet s c reply)))))