SocketTools .NET Edition

FtpClient.Connect Method (String, Int32, String, String, String, Int32)

Establish a connection with a remote host.

[Visual Basic]
Overloads Public Function Connect( _
   ByVal hostName As String, _
   ByVal hostPort As Integer, _
   ByVal userName As String, _
   ByVal userPassword As String, _
   ByVal userAccount As String, _
   ByVal timeout As Integer _
) As Boolean
[C#]
public bool Connect(
   string hostName,
   int hostPort,
   string userName,
   string userPassword,
   string userAccount,
   int timeout
);

Parameters

hostName
A string which specifies the remote host to establish a connection with. This may specify a host name or an Internet address in dot-notation.
hostPort
An integer which specifies the port number for the connection. This value must be greater than zero and the maximum valid port number is 65535.
userName
A string which specifies the user name which will be used to authenticate the client session. If the user name is specified as an empty string, then the login is considered to be anonymous.
userPassword
A string which specifies the password which will be used to authenticate the client session. This argument may be an empty string if no password is required for the specified user, or if no username has been specified.
userAccount
A string that specifies the account name to be used to authenticate the current client session. This parameter may be an empty string if no account name is required for the specified user.
timeout
An integer value that specifies the number of seconds that the method will wait for the connection to complete before failing the operation and returning to the caller. This value is only meaningful for blocking connections.

Return Value

A boolean value which specifies if the connection has been established. If the client is in blocking mode, a return value of true indicates that the connection has completed and the application may send and receive data from the remote host. If the client is in non-blocking mode, a return value of true indicates that the client has successfully created a socket and the connection is in progress.

When a non-blocking connection has completed, the OnConnect event will be fired. If this method returns false, the connection could not be established and the application should check the value of the LastError property to determine the cause of the failure.

See Also

FtpClient Class | SocketTools Namespace | FtpClient.Connect Overload List