listenContinuous

listenContinuous(): Connection;

The listenContinuous method of the Connection class waits for a remote application to connect to its port and returns a reference to the new connection on a new instance of the Connection class while the original instance is still available for listening on subsequent calls.

The Connection class state property changes to Connecting (1) when listening is in progress. The newly created instance of the Connection class has its state property set to Connected (2) after the successful connection.

See also the Connection class timeout property.

The following example shows the use of the listenContinuous method.

listenContinuous_click(btn: Button input) updating;
begin
    // Sets the connection to listen on the current port.  When a connection
    // is made, a new instance of the Connection class is returned and
    // referenced.  The original instance remains available for listening
    // on subsequent calls while the new instance maintains the newly made
    // connection.  When this connection is made, the status bar is set to
    // read 'connected', and the text box filled with the name information.
    self.connection := connection.listenContinuous;
    if self.connection.state = Connection.Connected then
        statusLine1.caption := "Connected";
        textBox.text        := connection2.name;
    endif;
end;