[TCPSend]Text to Send[/TCPSend]

Sends text to a TCP server program on a remote machine. (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]

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]

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


(Optional) text to look for that indicates end of line. Often [TCPSend end=%0D%0A] is used to look for <carriage return><line feed> as the end of line indicator, as is necessary when communicating with email POP servers or FTP servers.

Not necessary for communication with HTTP protocol, because the remote server disconnects automatically at the end of the session.