Created
April 22, 2024 12:09
-
-
Save sogaiu/2f11d48950a0fc9b210ffcb1bbb2197f to your computer and use it in GitHub Desktop.
janet unix domain socket
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# one terminal | |
$ janet | |
Janet 1.34.0-c01b32c4 linux/x64/gcc - '(doc)' for help | |
repl:1:> (def s (net/listen :unix "ptus" :datagram)) | |
<core/stream 0x55DAD743F760> | |
repl:2:> (def buf @"") | |
@"" | |
repl:3:> (def who (:recv-from s 1024 buf)) | |
<core/socket-address 0x55DAD7442020> | |
repl:4:> (pp buf) | |
@"hello" | |
nil | |
# another terminal | |
$ janet | |
Janet 1.34.0-c01b32c4 linux/x64/gcc - '(doc)' for help | |
repl:1:> (def c (net/connect :unix "ptus" :datagram)) | |
<core/stream 0x5618F5BA4830> | |
repl:2:> (net/write c "hello") | |
nil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment