Net.NetConn
Class: NetConn
net.NetConn
NetConn is a connection to a remote host. this is returned/create by Open and OpenTLS functions.
Example
Table of contents
Constructors
Methods
Constructors
constructor
• new NetConn(): NetConn
Returns
Defined in
net.ts:46
Methods
Close
▸ Close(): void
Close closes the connection.
Returns
void
Example
Defined in
net.ts:56
Recv
▸ Recv(N
): Uint8Array
Recv receives data from the connection with a timeout. If N is 0, it will read all data sent by the server with 8MB limit. it tries to read until N bytes or timeout is reached.
Parameters
Name | Type |
---|---|
N | number |
Returns
Uint8Array
Example
Defined in
net.ts:128
RecvHex
▸ RecvHex(N
): string
RecvHex receives data from the connection with a timeout in hex format. If N is 0,it will read all data sent by the server with 8MB limit.
Parameters
Name | Type |
---|---|
N | number |
Returns
string
Example
Defined in
net.ts:177
RecvPartial
▸ RecvPartial(N
): Uint8Array
RecvPartial is similar to Recv but it does not perform full read instead it creates a buffer of N bytes and returns whatever is returned by the connection this is usually used when fingerprinting services to get initial bytes from the server.
Parameters
Name | Type |
---|---|
N | number |
Returns
Uint8Array
Example
Defined in
net.ts:145
RecvString
▸ RecvString(N
): string
RecvString receives data from the connection with a timeout output is returned as a string. If N is 0, it will read all data sent by the server with 8MB limit.
Parameters
Name | Type |
---|---|
N | number |
Returns
string
Example
Defined in
net.ts:161
Send
▸ Send(data
): void
Send sends data to the connection with a timeout.
Parameters
Name | Type |
---|---|
data | string |
Returns
void
Example
Defined in
net.ts:112
SendArray
▸ SendArray(data
): void
SendArray sends array data to connection
Parameters
Name | Type |
---|---|
data | any |
Returns
void
Example
Defined in
net.ts:84
SendHex
▸ SendHex(data
): void
SendHex sends hex data to connection
Parameters
Name | Type |
---|---|
data | string |
Returns
void
Example
Defined in
net.ts:98
SetTimeout
▸ SetTimeout(value
): void
SetTimeout sets read/write timeout for the connection (in seconds).
Parameters
Name | Type |
---|---|
value | number |
Returns
void
Example
Defined in
net.ts:70
Was this page helpful?