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
NetConn
Defined in
net.ts:46Methods
Close
▸ Close():void
Close closes the connection.
Returns
void
Example
Defined in
net.ts:56Recv
▸ 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:128RecvHex
▸ 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:177RecvPartial
▸ 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:145RecvString
▸ 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:161Send
▸ Send(data
): void
Send sends data to the connection with a timeout.
Parameters
Name | Type |
---|---|
data | string |
Returns
void
Example
Defined in
net.ts:112SendArray
▸ SendArray(data
): void
SendArray sends array data to connection
Parameters
Name | Type |
---|---|
data | any |
Returns
void
Example
Defined in
net.ts:84SendHex
▸ SendHex(data
): void
SendHex sends hex data to connection
Parameters
Name | Type |
---|---|
data | string |
Returns
void
Example
Defined in
net.ts:98SetTimeout
▸ SetTimeout(value
): void
SetTimeout sets read/write timeout for the connection (in seconds).
Parameters
Name | Type |
---|---|
value | number |
Returns
void
Example