Skip to content

dgram: add synchronous Socket.prototype.bindSync()#63838

Open
guybedford wants to merge 1 commit into
nodejs:mainfrom
guybedford:dgram-bind-sync
Open

dgram: add synchronous Socket.prototype.bindSync()#63838
guybedford wants to merge 1 commit into
nodejs:mainfrom
guybedford:dgram-bind-sync

Conversation

@guybedford

Copy link
Copy Markdown
Contributor

WebAssembly embeddings of libc UDP support relies on a synchronous bind(2). While socket.bind that exposes this is asynchronous in Node.js, it is also completely fine to support a synchronous bind since it is a non-blocking operation in the OS when DNS resolution is excluded.

This adds a very simple socket.bindSync to the dgram API, allowing a direct mode for posix compatibility layers on Node.js without requiring JSPI.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/net

@nodejs-github-bot nodejs-github-bot added dgram Issues and PRs related to the dgram subsystem / UDP. needs-ci PRs that need a full CI run. labels Jun 10, 2026
Provides sync non-blocking bind(2), without DNS lookup

Signed-off-by: Guy Bedford <guybedford@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dgram Issues and PRs related to the dgram subsystem / UDP. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants