Skip to content

WASI: Split networking into a module #69

Closed

Description

@npmccallum

Please make networking its own module.

Activity

  1. added
    wasi:apiIssues pertaining to the WASI API, not necessarily specific to Wasmtime.
    on Mar 27, 2019
  2. sunfishcode commented on Mar 28, 2019

    @sunfishcode
    Member

    Currently there are only three networking-specific functions in WASI Core -- sock_send, sock_recv, and sock_shutdown. I have an idea for how we can merge sock_send and sock_recv with fd_write and fd_read (brief mention here), since they're very similar, and I believe would make the API more flexible and easier to understand.

    If we do that, a possible path forward here is to also rename sock_shutdown to fd_shutdown and say that WASI Core doesn't have explicit networking support -- it just has support for reading, writing, and (partially) shutting down streams, which can either be byte-oriented or datagram-oriented (and may or may not have in-order delivery, etc.). These might be connected to TCP or UDP sockets, or they might be connected to UNIX-domain sockets, or perhaps even something like TLSSock, or other things. The WASI Core API would limit itself to generic stream/datagram functionality. Creating and configuring (bind, connect, accept, setsockopt, etc.) sockets, or accessing protocol-specific features (sendmsg, recvmsg, etc.), would be handled by a different API module.

    What do you think of that approach?

  3. npmccallum commented on Mar 28, 2019

    @npmccallum
    MemberAuthor

    I'm all for innovation. But first watch this talk: https://www.youtube.com/watch?v=za41nQ6Ein8 :)

    I do think it makes sense to consolidate send()/write() and recv()/read(). However, there may be subtle differences. We should first learn why the fence is there.

    In general, I'm strongly in favor of modularizing and versioning the APIs by integrating with the WASM module system (see #74). This means we aren't stuck with the bad decisions we make today.

  4. sunfishcode commented on Mar 28, 2019

    @sunfishcode
    Member

    Yep :-). I've done some research and know quite a lot about why this particular fence is here, and even some of the accidental consequences it has. I'll write more about it when I make the actual proposal.

  5. sunfishcode commented on Feb 25, 2020

    @sunfishcode
    Member

    Merging send/recv into read/write is now being tracked in WebAssembly/WASI#4.

  6. added 2 commits that reference this issue on Dec 31, 2023
    baa9b2c
    f039423
  7. added a commit that references this issue on Oct 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    wasi:apiIssues pertaining to the WASI API, not necessarily specific to Wasmtime.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions