AtlatestRepositorysigil-socket
sigil-socket / treeREADME.md
1
# sigil-socket3
TCP, UDP, and Unix domain socket operations for [Sigil](https://codeberg.org/sigil/sigil).4
Provides network socket primitives suitable for both blocking and non-blocking5
I/O, including integration with Sigil's coroutine-based async runtime.7
This package was extracted from the sigil monorepo — the in-tree history8
under `packages/sigil-socket/` is preserved here as `master`.10
## Usage12
```scheme13
(import (sigil socket))15
;; TCP client16
(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 server23
(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
;; UDP31
(let ((sock (udp-socket)))32
(udp-send sock "127.0.0.1" 5000 "Hello")33
(socket-close sock))34
```36
The full export list lives at the top of `src/sigil/socket.sgl`. See37
`docs/socket.md` for a usage guide.39
## Build & test41
This is a pure-Scheme package. No native build step.43
```bash44
sigil deps install # fetch sigil-stdlib via codeberg:sigil/sigil-lang45
sigil test --report # run test/test-socket.sgl46
```48
For local development against an unpublished sigil-lang, use49
`dev-redirects.sgl` (sibling checkout at `../sigil-lang/`):51
```bash52
sigil deps install --redirects ./dev-redirects.sgl53
sigil test --redirects ./dev-redirects.sgl --report54
```56
## License58
BSD-3-Clause. See the monorepo for the canonical license text.