Skip to content

INT-03 follow-up: socket recv/send/accept primitives — byte-level buffer marshalling #487

Description

@hyperpolymath

ADR-015 S6b shipped net_shutdown (lowers to wasi_snapshot_preview1.sock_shutdown; command-adapter bridges to wasi:sockets/tcp) — the on-ramp. Larger socket primitives sock_recv / sock_send / sock_accept need byte-level buffer and network-address marshalling that goes beyond what S6b shipped.

Pattern is settled: the byte-level wasm IR (I32Load8U/I32Store8 and siblings) landed in #339 alongside env_at/arg_at and is what unblocks this. Helper shape will mirror gen_str_at_via_get (lib/wasi_runtime.ml): allocate iovec + byte buffer, call the WASI import, copy bytes into a length-prefixed AS string for the recv side; for send, walk the AS string into an iovec; for accept, read the new fd + remote-addr fields.

Effect surface stays Net (reserved at S6b). Component adapter already bridges to wasi:sockets/tcp internally — no host-side wasi:sockets/* requirement.

Ledger: INT-03 follow-up (S2 important — not substrate-blocking; the on-ramp suffices for net_shutdown consumers today). Refs #180.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew capability or improvement to existing behaviour

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions