An advanced TCP client written in SIMPL+. It helps to manage TCP/IP connections in a more reliable way (connect, send data, disconnect)
This module lets you input an IP address and port at runtime, which gives a lot of flexibility for testing and deploying the same code base across multiple systems. (IP address could be populated through something like a site specific configuration file for example)
debug – enable trace message output.
connect – pulse to force connection to specified address and port
(note: in order to reconnect, a full disconnect must be enforced
first before the socket will reconnect, or you can pulse the
reconnect signal to simplify this.)
disconnect – pulse to disconnect the socket from remote host/server.
reconnect – pulse to disconnect then connect after a short delay.
enable_persistent_connect – allows the tcp client to reconnect if the connection is
broken remotely. (note: if broken through locally (through programming)
the client will not attempt to automatically reconnect.)
enable_response_timeout_disconnect – flag to determine client should disconnect
if the [response_timeout] expires after data has been sent
and no response from the host/server has been received then the client will
automatically disconnect. (note: this might be good for determining whether
a reconnect is necessary in order to re-establish a good connection with the
device. programming that utilizes the [connected_fb] state to drive some
post-connection logic that ensures the program is in a good state after a
successful connection will benefit from this, without the need to spam reconnect
on disconnect which causes unnecessary network traffic more often than not.)
enable_reconnect_on_response_timeout – flag to simplify the reconnect process after a response
timeout disconnect so that the user only has to worry about the successful
post-connect logic, by using the [response_timeout_pulse] feedback pulse.
port – port that the client will connect to using the specified address.
address$ – address that the client will connect to.
connected_fb – high if client is connected to the remote host/server.
data_sent_pulse – pulsed when data has been sent to the remote host/server.
response_timeout_pulse – pulsed when the response timeout has expired, only if the response
timeout disconnect has been enabled.
status_fb – one of the following analog values depending on the socket status:
SOCKET_STATUS_NO_CONNECT = 0
SOCKET_STATUS_WAITING = 1
SOCKET_STATUS_CONNECTED = 2
SOCKET_STATUS_CONNECT_FAILED = 3
SOCKET_STATUS_BROKEN_REMOTELY = 4
SOCKET_STATUS_BROKEN_LOCALLY = 5
SOCKET_STATUS_DNS_LOOKUP = 6
SOCKET_STATUS_DNS_FAILED = 7
SOCKET_STATUS_DNS_RESOLVED = 8