Avisaro Online Documentation - Wiki
Impressum Kontakt Sitemap

CONNECT

Description

This command initiates a TCP connection to a remote host. CONNECT needs at least an IP address and a port number to establish a TCP connection.  A third argument (tx_delay in milliseconds) can be used for streaming mode to collect data until tx_delay elapses. A fourth argument, which is the keyword WAIT, causes the command machine to block until connection is established or timed out.

Parameter

CONNECT needs at least 3 and can have 1 or 2 additional arguments

1. Handle number
This can be any number from 101 to 200. If CONNECT succeeds, that number can be used in subsequent calls to other TCP-related commands.

2. IP Address
The IP address of the remote machine.

3. Port number
A port number where the remote service is listening.

4. TX timeout (optional)
A tx_delay value (time in milliseconds) used for TCP streaming.

5. Blocking / Non Blocking (optional)
The keyword WAIT

Return value

ERR_ARGUMENT (4) if one of the arguments is invalid
ERR_OK (0) if the command is accepted
ERR_NOCONN (38) if a connection could not be established

See (Mehr here)  for complete list of error codes.

Example

CONNECT 101 192.168.0.233 80

Connects to host 192.168.0.233 on port 80.

CONNECT 101 192.168.0.233 80 1000

Connects to host 192.168.0.233 on port 80 and sets the time-out for streaming mode to 1 second.

CONNECT 101 192.168.0.233 80 100 WAIT

Connects to host 192.168.0.233 on port 80, sets the time-out for streaming mode to 100 ms and waits until connection established or timed out.

Remarks

CONNECT only works with modules that have a network interface.