LassoScript Utility
Basics Browse Detail


Tag Link [Net->Listen] 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->Listen] is used to place a [Net] object into TCP listening mode. The [Net->Bind] tag must be used first to establish what port the connection should listen on. The [Net->Accept] tag can then be used to accept individual incoming connections.


Variable: 'Listener' = (Net);
$Listener->(Bind: 8000);
Variable: 'Connection' = $Listener->Accept;


No Parameters Required.


To listen for incoming TCP connections:

Use the [Net] type and its member tags to establish a TCP listener. The following example listens on port 80 for incoming TCP traffic. The [Net->Accept] tag returns a new connection and the IP address of the local machine and the remote machine are reported.

[Variable: 'myListener' = (Net)]
[$myListener->(Bind: 80)]
[Variable: 'myConnecton' = $myListener->(Accept)]
Local: [Output: $myConnection->(LocalAddress)]
Remote: [Output: $myConnection->(RemoteAddress)]
[Variable: 'Input' = $myConnection->(Read: 32768)]