[TCPConnect Parameters]TCPSend Contexts[/TCPConnect]

Connects to a TCP port of another computer on the internet. (New for 3.0)

To embed the results of a TCP session into one of your pages, put a TCPConnect context into a template, and put [TCPSend] contexts inside of that. The TCPSend steps contained inside the context are executed, and any returned value is displayed in place of the context. Any [xxx] tags inside the context are first substituted for their real values before the TCPSend is executed.

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):

[TCPConnect host=isd.smithmicro.com&port=80]
[TCPSend]GET / HTTP/1.0[UnURL]%0D%0A%0D%0A[/UnURL][/TCPSend]
[/TCPConnect]

In this example, the http command equivalent to the URL "http://isd.smithmicro.com/" is executed, and the results (the home page for that site) are displayed. 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 will never return any text, and the TCPSend will timeout while waiting for a response.

[TCPConnect host=internic.net&port=43]
<pre>[TCPSend]smithmicro.com[UnURL]%0D%0A[/UnURL][/TCPSend]</pre>
[/TCPConnect]

This example performs the equivalent of a WHOIS command which queries the Internic 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 know nothing about these protocols.

port

(Optional) TCP port number to connect to. If not specified, then 80 is assumed.