LassoScript Utility
Basics Browse Detail

[Net]

Tag Link [Net] Category Networking
Type Substitution Source Available No
Support Preferred Version 7.0
Change Unchanged Data Source Any
Output Type Net Security Tag
Implementation LCAPI Sets Lasso 8.5, Lasso 8.0, Lasso 7.0

Description

[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 Lasso using the appropriate member tags.

Syntax

<?LassoScript
Variable: 'Connection' = (Net);
$Connection->(Connect: 'www.example.com', '80');
...
$Connection->Close;
?>

Parameters

No Parameters Required.

Examples

To connect to a remote server using TCP:

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> ...