Click or drag to resize

SmartFoxConnect Method (ConfigData)

Establishes a connection between the client and a SmartFoxServer 2X instance using a configuration object.

Namespace:  Sfs2X
Assembly:  SmartFox2X (in SmartFox2X.dll) Version: 1.8.0.0 (1.8.0)
Syntax
C#
public void Connect(
	ConfigData cfg
)

Parameters

cfg
Type: Sfs2X.UtilConfigData
The client configuration object.
Exceptions
ExceptionCondition
ArgumentExceptionIf an invalid host/address or port is passed, and it can't be found in the loaded settings.
Remarks
The client usually connects to a SmartFoxServer instance through a socket connection. In case a socket connection can't be established, and the UseBlueBox property is set to true, a tunnelled http connection through the BlueBox module is attempted as a fail-safe system. When a successful connection is established, the ConnectionMode property can be used to check the current connection mode.

Tunnelled http connection is not available in case of websocket connection.

Examples
The following example connects to a local SmartFoxServer 2X instance:
ConfigData cfg = new ConfigData();
cfg.Host = "127.0.0.1";
cfg.Port = 9933;
cfg.Zone = "BasicExamples";

sfs.Connect(cfg);
See Also