nodejs / nodejs/userland-migrations

feat: handle `net._setSimultaneousAccepts()` deprecation

Open
#173 5 comments 0 reactions 1 assignee View on GitHub

@vespa7 is already working on this.

Since Nov 28, 2025.

good first issue human help wanted let's do it
Dominant language
TypeScript
Stars
85
Forks
55
Avg merge
3d 11h
Merged PRs (30d)
9

Description

Description

Since net._setSimultaneousAccepts() is deprecated (DEP0121) and has reached End-of-Life status, we should provide a codemod to replace it.

  • The codemod should remove calls to net._setSimultaneousAccepts() as it was an internal API.
  • The codemod should handle both CommonJS and ESM imports.
  • The codemod should suggest alternative approaches for connection handling if needed.
  • The codemod should remove this internal API usage completely.

Additional Information

Note that net._setSimultaneousAccepts() was removed in Node.js v24.0.0. The function was deprecated because it was an internal API that was never intended for public use. This function controlled how many connections could be accepted simultaneously on Windows, but this behavior is now handled automatically by Node.js.

The net._setSimultaneousAccepts() function was part of the internal networking implementation and its usage was not recommended or documented for public consumption.

Examples

Example 1: Remove internal API call

Before:

const net = require("node:net");

net._setSimultaneousAccepts(false);
const server = net.createServer();

After:

const net = require("node:net");

const server = net.createServer();
Example 2: Remove from server initialization

Before:

const net = require("node:net");

function createServer() {
  net._setSimultaneousAccepts(true);
  return net.createServer((socket) => {
    // handle connection
  });
}

After:

const net = require("node:net");

function createServer() {
  return net.createServer((socket) => {
    // handle connection
  });
}
Example 3: Remove from module setup

Before:

const net = require("node:net");

net._setSimultaneousAccepts(false);
module.exports = {
  createServer: () => net.createServer()
};

After:

const net = require("node:net");

module.exports = {
  createServer: () => net.createServer()
};
Example 4: Remove from application startup

Before:

const net = require("node:net");

function initializeApp() {
  net._setSimultaneousAccepts(true);
  const server = net.createServer();
  server.listen(3000);
}

After:

const net = require("node:net");

function initializeApp() {
  const server = net.createServer();
  server.listen(3000);
}
Example 5: ESM import cleanup

Before:

import net from "node:net";

net._setSimultaneousAccepts(false);
const server = net.createServer();

After:

import net from "node:net";

const server = net.createServer();
Example 6: Remove from configuration

Before:

const net = require("node:net");

const config = {
  simultaneousAccepts: false,
  port: 8080
};

function setupServer(config) {
  net._setSimultaneousAccepts(config.simultaneousAccepts);
  return net.createServer().listen(config.port);
}

After:

const net = require("node:net");

const config = {
  port: 8080
};

function setupServer(config) {
  return net.createServer().listen(config.port);
}

Refs

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.