Options
All
  • Public
  • Public/Protected
  • All
Menu

node-unix-socket

Index

Type Aliases

NotifyCb: (() => void)

Type declaration

    • (): void
    • Returns void

SendCb: ((err: undefined | Error) => void)

Type declaration

    • (err: undefined | Error): void
    • Parameters

      • err: undefined | Error

      Returns void

Functions

  • closeFd(fd: number): void
  • Close a fd.

    Note that you don't need to manually close fd that is listened by net.Server.

    Parameters

    • fd: number

    Returns void

  • createReuseportFd(port?: number, host?: string): number
  • Create a TCP socket with SO_REUSEADDR and SO_REUSEPORT enabled.

    Use the returned fd to create a net.Server:

    const fd = createReuseportFd(9229, '127.0.0.0');
    const server = require('net').createServer();
    server.listen({ fd }, () => { console.log('listen() successfully') })

    Parameters

    • port: number = 0
    • host: string = '0.0.0.0'

    Returns number

    Return a fd binds to the address.

Generated using TypeDoc