AtlatestRenderedmarkdown
Readme

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.