Skip to main content
Socket.prototype.end - net - Node documentation
method Socket.prototype.end

Usage in Deno

import { Socket } from "node:net";
Socket.prototype.end(callback?: () => void): this

Half-closes the socket. i.e., it sends a FIN packet. It is possible the server will still send some data.

See writable.end() for further details.

Parameters

optional
callback: () => void

Optional callback for when the socket is finished.

Return Type

this

The socket itself.

Socket.prototype.end(
buffer: Uint8Array | string,
callback?: () => void,
): this

Parameters

buffer: Uint8Array | string
optional
callback: () => void

Return Type

this
Socket.prototype.end(
str: Uint8Array | string,
encoding?: BufferEncoding,
callback?: () => void,
): this

Parameters

str: Uint8Array | string
optional
encoding: BufferEncoding
optional
callback: () => void

Return Type

this