CX · Reference guidecx-platform-net
PlaygroundDownloadsAboutv0.18.0-pre.1

cx-platform-net

sockets, TLS, the HTTP server, the XSP transport bindings, ftp, sftp, file_surface

Why reach for it

Every socket in CX is opened here, and none opens without your say-so. cx-platform-net is the wire: stream and datagram transports, TLS on either side, name resolution, and the HTTP/1.1 server that everything served on this site listens with. Every verb that touches the network is behind the net grant, and a denial is a value naming the flag that would allow it.

An address is a value before it is a socket. parse-addr reads a restricted transport URL or a bare host:port into an [addr] element — host, port, family, scheme — and refuses what a URL parser would happily carry into a dial: user information, a query, a path on a stream scheme, an unbracketed IPv6 literal. The corpus grades each refusal by name beside the round trips, so an address that reaches dial or listen is one the program could have inspected first.

The net grant gates the effects, not the arithmetic: resolve, dial, listen, accept, every read and write, and the datagram pair are each refused without it — one case per verb — and http adds no capability of its own. The server is an accept loop over a handler that maps a request to a response, with Server-Sent Events for held-open push and the WebSocket handshake graded frame by frame; what it serves and how a deployment runs it is the operations page. Two file-transfer modules share one file surface over it: ftp, FTP and FTPS over net's sockets and TLS, and sftp, an SSH session whose host key is checked against the rows a deployment pinned before any credential is used. The seven verbs, the bound root and the resumable transfer are one contract for both, every decision a pure function the corpus grades with no peer.

What it gives you

Four modules of the platform group: the transport layer, the HTTP server built over it, and file transfer over FTP and over SSH. Each links to the reference page the guide projects from the module's own documentation; the transports the store, the fabric and the application host speak over are these.

module import it as where it lives reference
ftp [?lib 'cx-platform/ftp'] Ring 1 · the platform group ftp reference
http [?lib 'cx-platform/http'] Ring 1 · the platform group http reference
net [?lib 'cx-platform/net'] Ring 1 · the platform group net reference
sftp [?lib 'cx-platform/sftp'] Ring 1 · the platform group sftp reference

Try it

A transport URL parsed into an address value — the host, the port and the family, as an element a program can pattern-match before anything is dialed. Nothing here needs a grant.

prog.cx

        [?lib 'cx-platform/net']
[$net:parse-addr 'tcp://example.com:443']
      
        $ cx prog.cx
[addr host='example.com' port=443 family=ipv4]
      

Fixture net-001-parse-addr-tcp in deps/cx-platform-net/conformance/platform/net.cxd — replayed against this cx when the page was built.

Status

The wire builds on the language and is built on by mail, identity, the store, the fabric and the application host; the front door compiles its V module from the pin.

fact as the registry records it
ships as binary
status extracted
pinned at 85077c2fe
builds on cx-core-code
built on by cx-platform-mail, cx-platform-identity, cx-platform-store, cx-platform-fabric, cx-platform-xap, cx-platform-sso
bundled modules 4
BUILDS ON THIS REPOSITORY · SHIPS BUILT ON BY cx-core-code cx-platform-net ftp http net sftp cx-platform-mail cx-platform-identity cx-platform-store cx-platform-fabric cx-platform-xap cx-platform-sso DRAWN FROM registry/repos.cxd's pins= COLUMN AND registry/modules.cxd WHEN THIS PAGE WAS BUILT
Fig. — what cx-platform-net plugs into: the repositories it builds on (left), the modules it ships (centre), the repositories that build on it (right) · drawn from registry/repos.cxd, deps.cxd and registry/modules.cxd when this page was built