Start Method  
 

Start listening for client connections on the specified IP address and port number.

Syntax

object.Start( [LocalAddress], [LocalPort], [Backlog], [MaxClients], [Timeout], [Options] )

Parameters

LocalAddress
An optional string value that specifies the IP address of the network adapter that the control should use when listening for connection requests. If this is an empty string, the server will listen for connection on all valid network interfaces configured for the local system. If this argument is not specified, the control will accept connections on the address specified by the value of the ServerAddress property.
LocalPort
An optional integer value that specifies the port number to listen for connections on. If this argument is not provided, it defaults to the value specified by the ServerPort property.
Backlog
An optional integer value that specifies the maximum size of the queue used to manage pending connections to the service. If the argument is set to value which exceeds the maximum size for the underlying service provider, it will be silently adjusted to the nearest legal value. On Windows workstations, the maximum backlog value is 5. On Windows servers, the maximum value is 200. If this argument is not provided, the value specified by the Backlog property will be used.
MaxClients
An optional integer value that specifies the maximum number of clients that may connect to the server. If this argument is not provided, the value specified by the MaxClients property will be used. A value of zero specifies that there is no fixed limit to the number of active client connections that may be established with the server. This value can be adjusted after the server has been created by calling the Throttle method
Timeout
An optional integer value that specifies the number of seconds the control will wait for a network operation to complete. If this argument is not specified, the value of the Timeout property will be used as the default
Options
An optional integer value that specifies specifies one or more socket options which are to be used when establishing the connection. The value is created by combining the options using a bitwise Or operator. Note that if this argument is specified, it will override any property values that are related to that option.
Value Constant Description
2 swOptionDontRoute This option specifies default routing should not be used. This option should not be specified unless absolutely necessary.
4 swOptionKeepAlive This option specifies that packets are to be sent to the remote system when no data is being exchanged to keep the connection active. This is the same as setting the KeepAlive property to a value of True.
8 swOptionReuseAddress This option specifies the local address can be reused when the server is stopped and immediately restarted. This is the same as setting the ReuseAddress property to a value of True.
16 swOptionNoDelay This option disables the Nagle algorithm, which buffers unacknowledged data and insures that a full-size packet can be sent to the remote host. This is the same as setting the NoDelay property to a value of True.
&H1000 swOptionSecure This option specifies the server will enable the security protocols and negotiate with the client to establish an encrypted session. This is the same as setting the Secure property to a value of True.<</td>

Return Value

A value of zero is returned if the operation was successful, otherwise a non-zero error code is returned which indicates the cause of the failure.

Remarks

The Start method begins listening for client connections on the specified local address and port number. The server is started in its own thread and manages the client sessions independently of the calling thread.

To listen for connections on any suitable IPv4 interface, specify the special dotted-quad address "0.0.0.0". You can accept connections from clients using either IPv4 or IPv6 on the same socket by specifying the special IPv6 address "::0", however this is only supported on Windows 7 and Windows Server 2008 R2 or later platforms. If no local address is specified, then the server will only listen for connections from clients using IPv4. This behavior is by design for backwards compatibility with systems that do not have an IPv6 TCP/IP stack installed.

See Also

MaxClients Property, ServerAddress Property, ServerPort Property, Timeout Property, Restart Method, Stop Method, OnStart Event