Skip to content

Conversation

@psnszsn
Copy link
Contributor

@psnszsn psnszsn commented Nov 15, 2025

Add support for vectored sendmsg/recvmsg (netSend/netReceive) in std.Io and the Threaded and Kqueue implementations.

The only users of these functions are std.Io.net.Socket, which I adapted to keep its existing API, and std.Io.Threaded.lookupDns

netReceive was somewhat special-cased for lookupDns I think. Instead of each message having a its own data buffer(or buffers for vectored io), it would use a common buffer and partition it for each message. This fits the lookupDns use-case, but is seriously limiting for a general purpose interface. It makes implementing things such as ring buffers impossible.

The changes boil down to:

  • IncomingMessage.data is now caller supplied instead of populated by the Io implementation. It can be a single buffer or multiple for vectored operations
  • Added separate field for bytes_sent/bytes_received instead of reusing the slice length
  • Made OutgoingMessage.address nullable to allow for usage with connected sockets (TCP, Unix) which do not need an address

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant