TCP/UDP socket operations for Sigil.
- Scheme 100%
|
David Wilson
00cf9f932d
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
The async-DNS wrapper depends on the resolver natives that shipped in the Sigil 0.17.0 runtime (%resolve-start, %resolve-take, %resolve-cancel, %tcp-connect-ip), so the compatibility floor moves to ^0.17. Lockfile re-pinned against the released v0.17.0 tag; build and 27/27 tests pass with the released 0.17.0 binary. |
||
|---|---|---|
| docs | docs: Add package documentation for sigil-socket and sigil-websocket | |
| src/sigil | Use async DNS when a scheduler is active | |
| test | Add unix-listen for Unix domain socket server support | |
| .gitignore | Extract sigil-socket from sigil monorepo as standalone repo | |
| .woodpecker.yml | Bump CI pin to sigil v0.14.3 | |
| dev-redirects.sgl | Extract sigil-socket from sigil monorepo as standalone repo | |
| manifest.scm | Extract sigil-socket from sigil monorepo as standalone repo | |
| package.sgl | Release 0.17.0: require Sigil ^0.17 for async DNS | |
| README.md | Extract sigil-socket from sigil monorepo as standalone repo | |
| sigil.lock | Release 0.17.0: require Sigil ^0.17 for async DNS | |
sigil-socket
TCP, UDP, and Unix domain socket operations for Sigil. Provides network socket primitives suitable for both blocking and non-blocking I/O, including integration with Sigil's coroutine-based async runtime.
This package was extracted from the sigil monorepo — the in-tree history
under packages/sigil-socket/ is preserved here as master.
Usage
(import (sigil socket))
;; TCP client
(let ((sock (tcp-connect "example.com" 80)))
(socket-write-line sock "GET / HTTP/1.0")
(socket-write-line sock "")
(display (socket-read-all sock))
(socket-close sock))
;; TCP server
(let ((server (tcp-listen 8080)))
(let loop ()
(let ((client (tcp-accept server)))
(socket-write-line client "Hello!")
(socket-close client)
(loop))))
;; UDP
(let ((sock (udp-socket)))
(udp-send sock "127.0.0.1" 5000 "Hello")
(socket-close sock))
The full export list lives at the top of src/sigil/socket.sgl. See
docs/socket.md for a usage guide.
Build & test
This is a pure-Scheme package. No native build step.
sigil deps install # fetch sigil-stdlib via codeberg:sigil/sigil-lang
sigil test --report # run test/test-socket.sgl
For local development against an unpublished sigil-lang, use
dev-redirects.sgl (sibling checkout at ../sigil-lang/):
sigil deps install --redirects ./dev-redirects.sgl
sigil test --redirects ./dev-redirects.sgl --report
License
BSD-3-Clause. See the monorepo for the canonical license text.