Skip to main content

net

(net).NetConn

NetConn is a connection to a remote host. Kind: inner class of net

netConn.Close()

Close closes the connection. Kind: instance method of NetConn
Throws:
  • error - The error encountered during connection closing.
Example

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 NetConn
Returns: Uint8Array - - The received data in an array.
Throws:
  • error - The error encountered during data receiving.
Example

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 NetConn
Returns: string - - The received data in hex format.
Throws:
  • error - The error encountered during data receiving.
Example

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 NetConn
Returns: string - - The received data as a string.
Throws:
  • error - The error encountered during data receiving.
Example

netConn.Send(data)

Send sends data to the connection with a timeout. Kind: instance method of NetConn
Throws:
  • error - The error encountered during data sending.
Example

netConn.SendArray(data)

SendArray sends array data to connection. Kind: instance method of NetConn
Throws:
  • error - The error encountered during data sending.
Example

netConn.SendHex(data)

SendHex sends hex data to connection. Kind: instance method of NetConn
Throws:
  • error - The error encountered during data sending.
Example

netConn.SetTimeout(value)

SetTimeout sets read/write timeout for the connection (in seconds). Kind: instance method of NetConn Example

(net).Open(protocol, address) ⇒ NetConn

Open opens a new connection to the address with a timeout. Supported protocols: tcp, udp. Kind: inner method of net
Returns: NetConn - - The NetConn object representing the connection.
Throws:
  • error - The error encountered during connection opening.
Example

(net).OpenTLS(protocol, address) ⇒ NetConn

OpenTLS opens a new connection to the address with a timeout. Supported protocols: tcp, udp. Kind: inner method of net
Returns: NetConn - - The NetConn object representing the connection.
Throws:
  • error - The error encountered during connection opening.
Example