LassoScript Utility
Basics Browse Detail


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


[Net->SetBlocking] requires a single boolean parameter which specifies whether the connection should block until reads and writes are complete. By default all connections use blocking.


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


Required Parameters
Boolean Specifies whether the connection should block or not.


To connect to a remote server using non-blocking TCP:

Use the [Net] type and its member tags to establish a TCP connection. The following example opens a non-blocking TCP connection to the Web server running on an example server and fetches the root document. The [Net->Wait] tag is used to wait until the connection is in the proper state for accepting data and until data is available for reading. The result will be an HTML page.

[Variable: 'myConnection' = (Net)]
[$myConnection->(SetBlocking: False)]
[Var: 'Result' = $myConnection->(Connect: '', 80)]
[Fail_If: $Result != Net_ConnectOK, (-1), 'TCP Error']
[Var: 'Result' = $myConnection->(Wait: 60, Net_WaitWrite)]
[Fail_If: $Result == Net_WaitTimeOut, (-1), 'TCP Timeout']
[Variable: 'Result' = $myConnection->(Write: 'GET / HTTP/1.0\r\n\r\n')]
[Var: 'Result' = $myConnection->(Wait: 60, Net_WaitRead)]
[Fail_If: $Result == Net_WaitTimeOut, (-1), 'TCP Timeout']
[Variable: 'Output' = $myConnection->(Read: 32768)]
[Output: $Output]

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