net
- net
NetConn.Close().Recv([N])⇒Uint8Array.RecvHex([N])⇒string.RecvString([N])⇒string.Send(data).SendArray(data).SendHex(data).SetTimeout(value)
Open(protocol, address)⇒NetConnOpenTLS(protocol, address)⇒NetConn
(net).NetConn
NetConn is a connection to a remote host. Kind: inner class ofnet
NetConn.Close().Recv([N])⇒Uint8Array.RecvHex([N])⇒string.RecvString([N])⇒string.Send(data).SendArray(data).SendHex(data).SetTimeout(value)
netConn.Close()
Close closes the connection. Kind: instance method ofNetConnThrows:
error- The error encountered during connection closing.
netConn.Recv([N]) ⇒ Uint8Array
Recv receives data from the connection with a timeout. If N is 0, it will read all available data.
Kind: instance method of NetConnReturns:
Uint8Array - - The received data in an array.Throws:
error- The error encountered during data receiving.
| Param | Type | Default | Description |
|---|---|---|---|
| [N] | number | 0 | The number of bytes to receive. |
netConn.RecvHex([N]) ⇒ string
RecvHex receives data from the connection with a timeout in hex format. If N is 0, it will read all available data.
Kind: instance method of NetConnReturns:
string - - The received data in hex format.Throws:
error- The error encountered during data receiving.
| Param | Type | Default | Description |
|---|---|---|---|
| [N] | number | 0 | The number of bytes to receive. |
netConn.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 available data.
Kind: instance method of NetConnReturns:
string - - The received data as a string.Throws:
error- The error encountered during data receiving.
| Param | Type | Default | Description |
|---|---|---|---|
| [N] | number | 0 | The number of bytes to receive. |
netConn.Send(data)
Send sends data to the connection with a timeout. Kind: instance method ofNetConnThrows:
error- The error encountered during data sending.
| Param | Type | Description |
|---|---|---|
| data | Uint8Array | The data to send. |
netConn.SendArray(data)
SendArray sends array data to connection. Kind: instance method ofNetConnThrows:
error- The error encountered during data sending.
| Param | Type | Description |
|---|---|---|
| data | Uint8Array | The array data to send. |
netConn.SendHex(data)
SendHex sends hex data to connection. Kind: instance method ofNetConnThrows:
error- The error encountered during data sending.
| Param | Type | Description |
|---|---|---|
| data | string | The hex data to send. |
netConn.SetTimeout(value)
SetTimeout sets read/write timeout for the connection (in seconds). Kind: instance method ofNetConn
| Param | Type | Description |
|---|---|---|
| value | number | The timeout value in seconds. |
(net).Open(protocol, address) ⇒ NetConn
Open opens a new connection to the address with a timeout. Supported protocols: tcp, udp.
Kind: inner method of netReturns:
NetConn - - The NetConn object representing the connection.Throws:
error- The error encountered during connection opening.
| Param | Type | Description |
|---|---|---|
| protocol | string | The protocol to use. |
| address | string | The address to connect to. |
(net).OpenTLS(protocol, address) ⇒ NetConn
OpenTLS opens a new connection to the address with a timeout. Supported protocols: tcp, udp.
Kind: inner method of netReturns:
NetConn - - The NetConn object representing the connection.Throws:
error- The error encountered during connection opening.
| Param | Type | Description |
|---|---|---|
| protocol | string | The protocol to use. |
| address | string | The address to connect to. |