CL_Tcp
This multi-purpose script is capable of both sending and retrieving data to and from the system. When called, the script performs these actions:
- Accepts input data from the client.
- Opens a TCP/IP connection to a pre-configured system protocol thread.
- Sends the input data to the system.
- Receives a response/reply.
- Returns the response/reply back to the client.
This script is considered multi-purpose because it is used for these basic functions:
- Sending data to the system and receiving a reply.
- Sending a request to the system and receiving back the response.
The script is also designed to permit multiple clients to run it simultaneously. With this feature, users can specify a range of socket ports. When a socket port is unavailable, due to another instance of the script already running, the next socket port is attempted. This happens until a port is found. You can also specify a time-out value, that, if exceeded, causes the script to give up and return a time-out error to the client.
For example, the CL_TcpQuery
script is
configured with a socket range of 9001to 9005. The system site is also configured
with five TCP/IP protocol threads, all of which are servers and are listening on
ports 9001 to 9005. With this configuration the web server can support a maximum of
five simultaneous web client connections to the system through the TCPQuery
script. If a sixth connection is attempted,
then the client would receive a time-out error if no connection is released before
the time-out interval expires.
Arguments are:
timeout
Optional. This specifies how much time, in seconds, the script can spend attempting to connect to system threads before returning a time-out error.
data
Required. This specifies the data to pass to the system.