title: NodeJS Net server crashes upon nmap scan
body: <p>I have programmed a server based on the Net module of NodeJS. It works perfectly fine, if I try to connect to it using a Net socket. However, if I try to scan it with nmap, it can't write to the socket, giving an <code>EPIPE</code> error.</p>
  <pre><code>    Error: write EPIPE
      at afterWriteDispatched (node:internal/stream_base_commons:160:15)
      at writeGeneric (node:internal/stream_base_commons:151:3)
      at Socket._writeGeneric (node:net:775:11)
      at Socket._write (node:net:787:8)
      at writeOrBuffer (node:internal/streams/writable:400:12)
      at _write (node:internal/streams/writable:341:10)
      at Socket.Writable.write (node:internal/streams/writable:345:10)
      at Server.&lt;anonymous&gt; (/server.js:6:10)
      at Server.emit (node:events:379:20)
      at TCP.onconnection (node:net:1555:8)
  Emitted 'error' event on Socket instance at:
      at emitErrorNT (node:internal/streams/destroy:188:8)
      at emitErrorCloseNT (node:internal/streams/destroy:153:3)
      at processTicksAndRejections (node:internal/process/task_queues:81:21) {
    errno: -32,
    code: 'EPIPE',
    syscall: 'write'
  }
  </code></pre>
  <p>I have simplified the server code to this:</p>
  <pre><code>const net = require('net');
  const server = net.createServer(socket =&gt; {
    socket.write('Test');
  });
  server.listen(30);
  </code></pre>
  <p>The nmap output just sais <code>30/tcp open  tcpwrapped</code>.
  I'm sure it has something to do with how nmap connects to the server. But I just can't work out how.</p>