schemelib/examples/udp_server.scm

19 lines
316 B
Scheme
Raw Normal View History

2020-07-09 08:03:55 +00:00
(load "../bindings/libc.scm")
(define (check-err ret msg)
(cond
((< ret 0)
(perror msg)
(raise msg))
(#t ret)))
(define (udp-sock fx)
(fx
(check-err
(socket 'AF_INET 'SOCK_DGRAM 'IPPROTO_NONE)
"Unable to init UDP socket")))
(udp-sock
(lambda (s)
(printf "~a~%" s)))