about summary refs log tree commit diff stats
path: root/mailbox.scm
diff options
context:
space:
mode:
Diffstat (limited to 'mailbox.scm')
-rw-r--r--mailbox.scm9
1 files changed, 5 insertions, 4 deletions
diff --git a/mailbox.scm b/mailbox.scm index 948804c..82eaaad 100644 --- a/mailbox.scm +++ b/mailbox.scm
@@ -1,6 +1,7 @@
1;; server bit 1;; server bit
2 2
3(import udp) 3(import udp
4 utf8)
4 5
5(define host "localhost") 6(define host "localhost")
6(define port 42069) 7(define port 42069)
@@ -9,11 +10,11 @@
9 (define s (udp-open-socket)) 10 (define s (udp-open-socket))
10 (udp-bind! s #f port) 11 (udp-bind! s #f port)
11 (let loop ((s s)) 12 (let loop ((s s))
12 (receive (len str) (udp-recv s 512) 13 (receive (len str host port) (udp-recvfrom s 512)
13 (when (= len 0) 14 (when (= len 0)
14 (loop s)) 15 (loop s))
15 (display str) 16 (print host ":" port "(" len ")\t" str)
16 (newline) 17 (udp-sendto s host port (string-append "received: " str))
17 (loop s)))) 18 (loop s))))
18 19
19(main) 20(main)