Initial UDP implementation.

This commit is contained in:
Calvin Rose
2020-06-02 19:47:50 -05:00
parent 3f434f2a44
commit ec0d0ba368
6 changed files with 240 additions and 71 deletions
+5
View File
@@ -0,0 +1,5 @@
(def conn (net/connect "127.0.0.1" "8009" :datagram))
(:write conn (string/format "%q" (os/cryptorand 16)))
(def x (:read conn 1024))
(pp x)
+6
View File
@@ -0,0 +1,6 @@
(def server (net/server "127.0.0.1" "8009" nil :datagram))
(while true
(def buf @"")
(def who (:recv-from server 1024 buf))
(printf "got %q from %v, echoing!" buf who)
(:send-to server who buf))