To embed the results of a TCP session into one of your pages, place a [TCPConnect] context into a template, and place [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.smithmicro.com/isd" 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!
|(Optional) text to look for indicating 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.