Start listening for client connections on the specified IP address
and port number.
object.Start( [ServerAddress], [ServerPort],
[Directory] [MaxClients], [IdleTime], [Options] )
- An optional string which specifies the local hostname or
IP address address that the server should be bound to. If this
parameter is an empty string, then an appropriate address will
automatically be used. If a specific address is used, the server
will only accept client connections on the network interface that is
bound to that address. If this parameter is omitted, the control will accept
connections on the address specified by the value of the
- An optional integer that specifies the port number the server should use to listen
for client connections. If a value of zero is specified, the server
will use the standard port number 21 to listen for connections, or
port 990 if the server is configured to use implicit SSL. The port
number used by the application must be unique and multiple instances
of a server cannot use the same port number. It is recommended that
a port number greater than 5000 be used for private, application-specific
implementations. If this parameter is omitted, it defaults to the
value specified by the ServerPort property.
- An optional string that specifies the path to the root directory
for the server. If this parameter is omitted, it defaults to the
value specified by the Directory property. If this property
is not set and no directory is specified, the server will use the
current working directory as the root directory.
- An optional integer value that specifies the maximum number of clients that may
connect to the server. If this parameter is omitted, the value
specified by the MaxClients property will be used. This
value can be adjusted after the server has been created by calling
the Throttle method.
- An optional integer value that specifies the number of seconds
a client can be idle before the server terminates the session.
If this argument is not specified, the value of the IdleTime
property will be used. The default idle timeout period is 300
seconds (5 minutes).
- An optional integer value that specifies specifies one or more
server options. This 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.
For a list of options, see
Server Option Constants.
A value of zero is returned if the server was started,
otherwise a non-zero error code is returned which indicates the cause
of the failure.
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
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
It is recommended that you always specify an absolute path for the
server root directory, either by passing the full pathname as an
argument to this method or by setting the Directory property.
If the path includes environment variables surrounded by percent (%)
symbols, they will be automatically expanded.
If you have configured the server to permit clients to upload files,
you must ensure that your application has permission to create files
in the directory that you specify. A recommended location for the server
root directory would be a subdirectory of the %ALLUSERSPROFILE%
directory. Using the environment variable ensures that your server will
work correctly on different versions of Windows. If the root directory does
not exist at the time that the server is started, it will be created.