LassoScript Utility
Basics Browse Detail


Tag Link [Net->Accept] 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->Accept] is used with TCP listeners to accept an incoming connection. The tag returns a new [Net] object that represents the connection with the remote server that initiated the request. [Net->Accept] will wait forever for an incoming connection. [Net->Accept] can be used multiple times to accept requests from many different remote servers using the same listener.

In order to prepare a [Net] object as a listener the [Net->SetType] tag must be called with [Net_TypeTCP], the object must be bound to a port using [Net->Bind] and the object must be put into listening mode using [Net->Listen].


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)]