import { EventEmitter } from 'node:events'; import { Socket } from './socket.js'; export interface ListenOptions { port?: number; host?: string; backlog?: number; exclusive?: boolean; } export declare class Server extends EventEmitter { listening: boolean; maxConnections?: number; allowHalfOpen: boolean; private _service; private _connections; private _address; constructor(connectionListener?: (socket: Socket) => void); constructor(options?: { allowHalfOpen?: boolean; }, connectionListener?: (socket: Socket) => void); /** * Start listening for connections. */ listen(port?: number, host?: string, backlog?: number, callback?: () => void): this; listen(port?: number, host?: string, callback?: () => void): this; listen(port?: number, callback?: () => void): this; listen(options?: ListenOptions, callback?: () => void): this; private _handleConnection; /** Get the address the server is listening on. */ address(): { port: number; family: string; address: string; } | null; /** Close the server, stop accepting new connections. */ close(callback?: (err?: Error) => void): this; /** Get the number of concurrent connections. */ getConnections(callback: (err: Error | null, count: number) => void): void; ref(): this; unref(): this; }