Start Method

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

Syntax

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

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. All arguments are optional. If a given argument is missing, then a corresponding property or properties must be set before attempting the connection, as follows:

LocalAddress specifies the IP address of the network adapter that the control should use when listening for connection requests. If this is an empty string or the special address "0.0.0.0" is specified, 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 specified 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 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 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 specifies the number of seconds the control will wait for a network operation to complete. A value of zero indicates that the control should wait indefinitely for the operation to complete, however it is not recommended that you use this value. If this argument is not specified, the value of the Timeout property will be used as the default.

Options 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 that 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 that 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, and requires that a Secure Edition license.

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.

See Also

Backlog Property, MaxClients Property, ServerAddress Property, ServerPort Property, Timeout Property, Restart Method, Resume Method, Suspend Method, Throttle Method, OnAccept Event


Copyright © 2010 Catalyst Development Corporation. All rights reserved.