[Net] is an object which represents a TCP or UDP connection to a remote host. The member tags of this object allow connections to be made to remote hosts and for listeners to be created which will respond to incoming connection attempts.
The [Net] type allow Lasso to serve as an application server for many different network protocols including SMTP, FTP, Telnet, and more. The [Net] type provides the low-level TCP, SSL, and UDP connection, but the details of the high-level protocol must be implemented in LDML using the appropriate member tags.
<?LassoScript
Variable: 'Connection' = (Net);
$Connection->(Connect: 'www.example.com', '80');
...
$Connection->Close;
?>
Use the [Net] type and its member tags to establish a TCP connection. The following example opens a blocking TCP connection to the Web server running on an example server and fetches the root document. The result will be an HTML page.
[Variable: 'myConnection' = (Net)]
[$myConnection->(SetBlocking: True)]
[$myConnection->(SetType: Net_TypeTCP)]
[Var: 'Result' = $myConnection->(Connect: 'www.example.com', 80)]
[Fail_If: $Result != Net_ConnectOK, (-1), 'TCP Error']
[Variable: 'Result' = $myConnection->(Write: 'GET /\r\n')]
[Variable: 'Output' = $myConnection->(Read: 32768)]
[$myConnection->(Close)]
[Output: $Output]
<html><head><title>HTML Document</title></head>>body> ...
Tag Link | [Net] | Category | Networking |
---|---|---|---|
Type | Substitution | Data Source | Any |
Support | Preferred | Version | 7.0 |
Output Type | Net | Security | Tag |
Implementation | Sets | Lasso 7.0 |
Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.
©LassoSoft Inc 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft