Skip to main content
Module

x/net/mod.ts>TCPClient

A networking framework that aims to enable the development of complex multi-port servers and clients.
Go to Latest
class TCPClient
Re-export
import { TCPClient } from "https://deno.land/x/net@v1.0.4/mod.ts";

TCP client

Constructors

new
TCPClient(connection?: Deno.Conn | null)

Properties

private
connection: Deno.Conn | null
private
isConnected: boolean
readonly
connected: boolean

Checks if the client is connected to the server

events: EventEmitter
readonly
localAddr: Deno.NetAddr | null

Get local address

readonly
remoteAddr: Deno.NetAddr | null

Get remote address

Methods

Closes the connection

connect(host: string, port: number)

Connects to the server

Starts listening for data from the server

write(data: Uint8Array)

Sends data to the server