diff --git a/minimart/examples/udp-hello.rkt b/minimart/examples/udp-hello.rkt index 4b6bc3e..da5347e 100644 --- a/minimart/examples/udp-hello.rkt +++ b/minimart/examples/udp-hello.rkt @@ -4,13 +4,8 @@ (spawn-udp-driver) -(spawn (lambda (e s) - (match e - [(message (udp-packet src dst body) _ _) - (log-info "Got packet from ~v: ~v" src body) - (transition s (send (udp-packet dst - src - (string->bytes/utf-8 (format "You said: ~a" body)))))] - [_ #f])) - (void) - (gestalt-union (sub (udp-packet ? (udp-listener 5999) ?)))) +(actor #:name echoer + (subscribe (udp-packet ($ src) ($ dst (udp-listener 5999)) ($ body)) + (log-info "Got packet from ~v: ~v" src body) + (define reply (string->bytes/utf-8 (format "You said: ~a" body))) + (send (udp-packet dst src reply))))