Skip to content

Datagrams and read/write streams #61631

@prettydiff

Description

@prettydiff

What is the problem this feature will solve?

A datagram socket, UDP, should have a readable and writable interface as TCP sockets created from the net library have readable and writable interfaces. This will allow streamed pipes to and from a given UDP socket. Allowing streamed pipes will allow moving data fragments from the file system, or experimental SQLite Database, or various other interfaces at great reduction to concurrency costs.

There are some complexities to consider:

  • UDP sockets support multicast when executed as a listener. UDP sockets already allow for queue control and message buffer size, but this would need to be stress tested with regard to message from a writable pipe to potential layer 2 congestion with a large number of multicast subscribers.
  • Multicast definitions, at least in Node, can only be set from the listening side (server side) of a UDP socket, so this should have no impact on readable stream congestion.
  • With readable and writable stream interfaces data can then be piped directly between sockets irrespective of their layer 4 protocol (TCP/UDP). This should expect to fail if the given TCP socket opens a writable stream to a UDP socket because Node does not yet support encryption for UDP.
  • This should expect to operate as message fragments in memory and so operate irrespective of TCP's 3-way handshake, which might cause congestion issues if data flows from UDP faster than the given TCP stream can accept it as Node TCP sockets do not appear to have a Node-based queue mechanism.

What is the feature you are proposing to solve the problem?

Apply the same stream interfaces currently afforded to net sockets onto datagram sockets.

Read/write streams as proposed in this issue and DTLS will both be required to enable future support to a QUIC (HTTP/3) library.

What alternatives have you considered?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestIssues that request new features to be added to Node.js.

    Type

    No type

    Projects

    Status

    Awaiting Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions