TCP Client

Application can create TCP client socket, read from/write to or close the TCP socket.

Libre_IoDeviceTcp

Libre_IoDeviceTcp(device, port, timeout)

Connects to a port on a local ethernet device discovered by Liberty IoT Hub.

Parameters:

  • device - Integer, internal device ID.
  • port - Integer, the TCP port.
  • timeout - Integer, in seconds.

Returns:

  • The socket handle.

Note: The returned socket handle shall be used in TCP read/write and close; as well as event subscription.

Libre_IoTcp

Libre_IoTcp(host, port, timeout)

Connects to a port on a local ethernet device discovered by Liberty IoT Hub.

Parameters:

  • host - String, the string representation of IP or host name.
  • port - Integer, the TCP port.
  • timeout - Integer, in seconds.

Returns:

  • The socket handle.

Note: The returned socket handle shall be used in TCP read/write and close; as well as event subscription. Note: Connecting to external host is highly regulated by our privacy policy. Applications from our App Store must follow our privacy guideline in order to get approved. External host is allowed on “whitelist” basis per application and specific hosts.