Skip to main content
Deno 2 is finally here 🎉️
Learn more
Go to Latest
The Standard Library has been moved to JSR. See the blog post for details.
class TCP
import { TCP } from "https://deno.land/std@0.115.1/node/internal_binding/tcp_wrap.ts";

Constructors

new
TCP(type: number, conn?: Deno.Conn)

Creates a new TCP class instance.

Properties

reading: boolean
[ownerSymbol]: unknown

Methods

_onClose(): Promise<number>

Handle server closure.

bind(address: string, port: number): number

Bind to an IPv4 address.

bind6(
address: string,
port: number,
flags: number,
): number

Bind to an IPv4 address.

connect(
address: string,
port: number,
): number

Connect to an IPv4 address.

connect6(
address: string,
port: number,
): number

Connect to an IPv6 address.

getpeername(peername: Record<string, never> | AddressInfo): number

Populates the provided object with remote address entries.

getsockname(sockname: Record<string, never> | AddressInfo): number

Populates the provided object with local address entries.

listen(backlog: number): number

Listen for new connections.

open(_fd: number): number

Opens a file descriptor.

setKeepAlive(_enable: boolean, _initialDelay: number): number
setNoDelay(_noDelay: boolean): number
deprecated
setSimultaneousAccepts(_enable: boolean)

Windows only.

Deprecated by Node. REF: https://github.com/nodejs/node/blob/master/lib/net.js#L1731