about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2023-04-04 15:08:49 -0500
committerCase Duckworth2023-04-04 15:08:49 -0500
commit9a2924110a32776373c6b090c60d5299a388f7fe (patch)
treedc03d3cf8169f35c7e3637ccf3615f795c8cfa18
downloadpostcard-9a2924110a32776373c6b090c60d5299a388f7fe.tar.gz
postcard-9a2924110a32776373c6b090c60d5299a388f7fe.zip
Initial commit
Proof of concept. Works on localhost
-rw-r--r--.gitignore8
-rw-r--r--mailbox.scm19
-rw-r--r--postcard.scm13
3 files changed, 40 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..93f8b42 --- /dev/null +++ b/.gitignore
@@ -0,0 +1,8 @@
1mailbox
2postcard
3*.o
4*.so
5
6
7
8
diff --git a/mailbox.scm b/mailbox.scm new file mode 100644 index 0000000..948804c --- /dev/null +++ b/mailbox.scm
@@ -0,0 +1,19 @@
1;; server bit
2
3(import udp)
4
5(define host "localhost")
6(define port 42069)
7
8(define (main)
9 (define s (udp-open-socket))
10 (udp-bind! s #f port)
11 (let loop ((s s))
12 (receive (len str) (udp-recv s 512)
13 (when (= len 0)
14 (loop s))
15 (display str)
16 (newline)
17 (loop s))))
18
19(main)
diff --git a/postcard.scm b/postcard.scm new file mode 100644 index 0000000..5e54178 --- /dev/null +++ b/postcard.scm
@@ -0,0 +1,13 @@
1;; client bit
2
3(import udp
4 (chicken process-context))
5
6(define host "localhost")
7(define port 42069)
8
9(define (main args)
10 (define s (udp-open-socket))
11 (udp-sendto s host port (apply string-append args)))
12
13(main (command-line-arguments))