Package-level declarations

Types

Link copied to clipboard
sealed external interface AddressInfo
Link copied to clipboard
external class BlockList

The BlockList object can be used with some network APIs to specify rules for disabling inbound or outbound access to specific IP addresses, IP ranges, or IP subnets.

Link copied to clipboard
sealed external interface ConnectOpts
Link copied to clipboard
sealed external interface DropArgument
Link copied to clipboard
Link copied to clipboard
sealed external interface IpcSocketConnectOpts : ConnectOpts
Link copied to clipboard
sealed external interface IPVersion
Link copied to clipboard
sealed external interface ListenOptions : Abortable
Link copied to clipboard
typealias LookupFunction = (hostname: String, options: LookupOptions, callback: (err: ErrnoException?, address: Any, family: Double?) -> Unit) -> Unit
Link copied to clipboard
typealias NetConnectOpts = Any
Link copied to clipboard
sealed external interface OnReadOpts
Link copied to clipboard
open external class Server : EventEmitter

This class is used to create a TCP or IPC server.

Link copied to clipboard
external interface ServerOpts
Link copied to clipboard
open external class Socket : Duplex

This class is an abstraction of a TCP socket or a streaming IPC endpoint (uses named pipes on Windows, and Unix domain sockets otherwise). It is also an EventEmitter.

Link copied to clipboard
external class SocketAddress
Link copied to clipboard
sealed external interface SocketAddressInitOptions
Link copied to clipboard
Link copied to clipboard
sealed external interface SocketConstructorOpts
Link copied to clipboard
sealed external interface SocketReadyState
Link copied to clipboard
Link copied to clipboard
external interface TcpSocketConnectOpts : ConnectOpts

Functions

Link copied to clipboard
external fun connect(options: NetConnectOpts, connectionListener: () -> Unit = definedExternally): Socket

Aliases to {@link createConnection}.

external fun connect(path: String, connectionListener: () -> Unit = definedExternally): Socket
external fun connect(port: Number, host: String = definedExternally, connectionListener: () -> Unit = definedExternally): Socket
Link copied to clipboard
external fun createConnection(options: NetConnectOpts, connectionListener: () -> Unit = definedExternally): Socket

A factory function, which creates a new {@link Socket}, immediately initiates connection with socket.connect(), then returns the net.Socket that starts the connection.

external fun createConnection(path: String, connectionListener: () -> Unit = definedExternally): Socket
external fun createConnection(port: Number, host: String = definedExternally, connectionListener: () -> Unit = definedExternally): Socket
Link copied to clipboard
external fun createServer(): Server
external fun createServer(options: ServerOpts = definedExternally, connectionListener: (socket: Socket) -> Unit = definedExternally): Server

external fun createServer(connectionListener: (socket: Socket) -> Unit = definedExternally): Server

Creates a new TCP or IPC server.

Link copied to clipboard

Gets the current default value of the autoSelectFamily option of socket.connect(options). The initial default value is true, unless the command line option--no-network-family-autoselection is provided.

Link copied to clipboard

Gets the current default value of the autoSelectFamilyAttemptTimeout option of socket.connect(options). The initial default value is 250 or the value specified via the command line option --network-family-autoselection-attempt-timeout.

Link copied to clipboard
external fun isIP(input: String): Double

Returns 6 if input is an IPv6 address. Returns 4 if input is an IPv4 address in dot-decimal notation with no leading zeroes. Otherwise, returns0.

Link copied to clipboard
external fun isIPv4(input: String): Boolean

Returns true if input is an IPv4 address in dot-decimal notation with no leading zeroes. Otherwise, returns false.

Link copied to clipboard
external fun isIPv6(input: String): Boolean

Returns true if input is an IPv6 address. Otherwise, returns false.

Link copied to clipboard
external fun setDefaultAutoSelectFamily(value: Boolean)

Sets the default value of the autoSelectFamily option of socket.connect(options).

Link copied to clipboard

Sets the default value of the autoSelectFamilyAttemptTimeout option of socket.connect(options).