LassoScript Utility
Basics Browse Detail


Tag Link [Net->Close] Category Networking
Type Member Source Available Yes
Support Preferred Version 7.0
Change Unchanged Data Source Any
Output Type None Security None
Implementation LCAPI Sets Lasso 8.5, Lasso 8.0, Lasso 7.0


[Net->Close] closes an open network connection. This tag will close either outgoing or incoming connections. [Net->Close] should be used on each connection when communication is done to ensure that no ports are left open longer than necessary.


Variable: 'Connection' = (Net);
$Connection->(Connect: '', 80);


No Parameters Required.


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)]
[Var: 'Result' = $myConnection->(Connect: '', 80)]
[Fail_If: $Result != Net_ConnectOK, (-1), 'TCP Error']
[Variable: 'Result' = $myConnection->(Write: 'GET / HTTP/1.0\r\n\r\n')]
[Variable: 'Output' = $myConnection->(Read: 32768)]
[Output: $Output]

<html><head><title>HTML Document</title></head>>body> ...