Class: Sock

Sock

Provides methods for creating and destroying connections to a TCP port.


Example
var sock = $wat.load('sock')[0];

Methods


createAsciiClient(host, port [, name])

Create a new instance of a sock.AsciiClient using the supplied host and port.

The object created will be cleaned up automatically, but only when the page reloads. If these objects are re-created without reloading the page, then they must be deleted using destroy, otherwise a memory leak will occur.

Parameters:
Name Type Argument Default Description
host string

The name of the host (e.g. IP address) to connect to.

port number

The TCP port on the host to connect to.

name string <optional>
""

If specified, the object returned will also be accessible as a property of this object, with the same name as the new device.

Since:
  • 0.1 (WAT 1.1)
Returns:
Type
sock.AsciiClient

destroy(obj)

Delete a previously created client.

Parameters:
Name Type Description
obj sock.AsciiClient

The client to delete.

Since:
  • 0.1 (WAT 1.1)