AtlatestRepositorysigil-socket
1# sigil-socket
2
3> **Archived at Sigil 0.19.0:** The maintained implementation now lives in
4> `codeberg:sigil/sigil`. This repository and all tags remain available for
5> provenance, but no further standalone releases will be published.
6
7TCP, UDP, and Unix domain socket operations for [Sigil](https://codeberg.org/sigil/sigil).
8Provides network socket primitives suitable for both blocking and non-blocking
9I/O, including integration with Sigil's coroutine-based async runtime.
11This package was extracted from the sigil monorepo — the in-tree history
12under `packages/sigil-socket/` is preserved here as `master`.
14## Usage
16```scheme
17(import (sigil socket))
19;; TCP client
20(let ((sock (tcp-connect "example.com" 80)))
21 (socket-write-line sock "GET / HTTP/1.0")
22 (socket-write-line sock "")
23 (display (socket-read-all sock))
24 (socket-close sock))
26;; TCP server
27(let ((server (tcp-listen 8080)))
28 (let loop ()
29 (let ((client (tcp-accept server)))
30 (socket-write-line client "Hello!")
31 (socket-close client)
32 (loop))))
34;; UDP
35(let ((sock (udp-socket)))
36 (udp-send sock "127.0.0.1" 5000 "Hello")
37 (socket-close sock))
38```
40The full export list lives at the top of `src/sigil/socket.sgl`. See
41`docs/socket.md` for a usage guide.
43## Build & test
45This is a pure-Scheme package. No native build step.
47```bash
48sigil deps install # fetch sigil-stdlib via codeberg:sigil/sigil-lang
49sigil test --report # run test/test-socket.sgl
50```
52For local development against an unpublished sigil-lang, use
53`dev-redirects.sgl` (sibling checkout at `../sigil-lang/`):
55```bash
56sigil deps install --redirects ./dev-redirects.sgl
57sigil test --redirects ./dev-redirects.sgl --report
58```
60## License
62BSD-3-Clause. See the monorepo for the canonical license text.