Lightstreamer PCL (Portable Class Libraries) Client 3.0.0
ContentsIndexHome
PreviousUpNext
LSClient.OpenConnection Method

Opens a connection to the Server with the supplied parameters. More precisely, the Server will initiate a push session for this client, which will be accessed through a streaming connection or through a train of polling connections, depending on the configuration parameters. If a connection is already open, it is closed first. 

If streaming (as opposed to polling) is specified in the connection parameters and the environment does not allow HTTP streaming, then the "Stream-sense" feature, if enabled, is activated; hence, if the streaming connection has not yielded any data after a few seconds, a polling connection is tried instead. 

The method is blocking; it returns only after a connection to the Server has been established or the attempt has failed. It is possible to enforce timeouts for the socket connection task and for any further read task by setting suitable global properties in advance. It can be done by invoking the global "AppDomain.CurrentDomain.SetData" with parameter name, respectively, "lightstreamer.client.defaultConnectTimeout" and "lightstreamer.client.defaultReadTimeout" and an int value expressed in milliseconds. Note that the read timeout set will apply to the whole life of the socket and it should be far greater than the timeouts specified in the ConnectionInfo parameter. By the way, these settings will also apply to connections used for subscriptions and other control requests.  

Edition Note: Connections from the .NET Client Library are not supported by the Server, if it runs in Allegro edition. 

Edition Note: Connections from the .NET Client Library are not supported by the Server, if it runs in Moderato edition. 

 

C++
public: void OpenConnection(ConnectionInfo info, IConnectionListener listener);
C#
public virtual void OpenConnection(ConnectionInfo info, IConnectionListener listener);
Visual Basic
Public virtual Function OpenConnection(info As ConnectionInfo, listener As IConnectionListener) As void
Parameters 
Description 
ConnectionInfo info 
Contains the Server address and the connection parameters. A copy of the object is stored internally. 
IConnectionListener listener 
Receives notification for connection events.  
Exceptions 
Description 
in case of connection problems. 
in case of errors in the supplied parameters or in Server answer. In normal operation, this should not happen. 
in case the Server has refused the connection request because of the constraints imposed either by the Metadata Adapter or by Server configuration.