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