Thread Pool · Level 3 of 7

Sockets skip the pool

A tiny server and a client on your own machine. Watch which zone the network uses.

const net = require('node:net');const server = net.createServer((socket) => {  socket.end('hi');});server.listen(0, '127.0.0.1', () => {  console.log('listening');  const client = net.connect(server.address().port, '127.0.0.1');  client.on('data', (d) => {    console.log('client got ' + d);    server.close();  });});console.log('sync done');

1. Predict the output

Tap the lines in the order you think they print.

  1. 1…
  2. 2…
  3. 3…