To embed the results of a TCP session into one of your pages, place a [TCPConnect] context into a template, and put [TCPSend] contexts inside of that. The TCPSend steps contained inside the context execute, and any returned value displays in place of the context. Any [xxx] tags inside the context are first substituted for their real values before the TCPSend executes.
TCPConnect does nothing by itself; you must insert one or more [TCPSend] contexts inside it to perform any real work. TCPConnect establishes a connection to the TCP server program and provides an environment for the TCPSend contexts to do their work and return text results.
Example (normally you would put the following text into a .TPL file on your server and use a web browser to link to it):
In this example, the http command equivalent to the URL "http://www.webdna.us" executes, and the results (the home page for that site) display. Notice the use of [UnURL] to send <Carriage Return><LineFeed><Carriage Return><LineFeed> as part of the TCPSend text. If you do not send the correct sequence of 2 CR/LF characters, the remote web server never returns any text, and the TCPSend times out while waiting for a response.
This example performs the equivalent of a WHOIS command which queries the Internet for information about a particular domain name. Substitute your own domain name and see what you get!
Parameter | Description |
---|---|
host
|
(Required) Name or ip address of the machine to connect to. Do not insert http or ftp into the host text! TCPConnect is a very low-level connection, and it knows nothing about these protocols. |
port
|
(Optional) TCP port number to connect to. If not specified, then 80 is assumed. |
ssl
|
New for version 4.5 (Optional) Set this parameter to 'T' to create a secure socket. The port parameter should normally be set to 443 in this case. |