about summary refs log tree commit diff stats
path: root/postcard.scm
blob: 7c1eed66af448968881cf6f90312431c32229b2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
;; client bit

(import srfi-13
        udp
        utf8
        (chicken process-context))

(define host "95.216.214.66")
(define port 42069)

(define (main args)
  (define s (udp-open-socket))
  (udp-bind! s #f 0) ; automatically allocate one
  (udp-sendto s host port (string-join args " "))
  (let loop ((s s))
    (receive (len str host port) (udp-recvfrom s 512)
      (when (= len 0)
        (loop s))
      (print host ":" port "\t" str))))

(main (command-line-arguments))