about summary refs log tree commit diff stats
path: root/postcard.scm
diff options
context:
space:
mode:
Diffstat (limited to 'postcard.scm')
-rw-r--r--postcard.scm14
1 files changed, 11 insertions, 3 deletions
diff --git a/postcard.scm b/postcard.scm index 5e54178..7c1eed6 100644 --- a/postcard.scm +++ b/postcard.scm
@@ -1,13 +1,21 @@
1;; client bit 1;; client bit
2 2
3(import udp 3(import srfi-13
4 udp
5 utf8
4 (chicken process-context)) 6 (chicken process-context))
5 7
6(define host "localhost") 8(define host "95.216.214.66")
7(define port 42069) 9(define port 42069)
8 10
9(define (main args) 11(define (main args)
10 (define s (udp-open-socket)) 12 (define s (udp-open-socket))
11 (udp-sendto s host port (apply string-append args))) 13 (udp-bind! s #f 0) ; automatically allocate one
14 (udp-sendto s host port (string-join args " "))
15 (let loop ((s s))
16 (receive (len str host port) (udp-recvfrom s 512)
17 (when (= len 0)
18 (loop s))
19 (print host ":" port "\t" str))))
12 20
13(main (command-line-arguments)) 21(main (command-line-arguments))