Dart Ftp Control
Login Method
Optional. Specifies the hostname or IP address of the server.
Optional. Specifies a user name for an account on the server.
Optional. Specifies the account password associated with User.
Optional. Specifies an account on the server.
Optional. Specifies the remote port to connect to. Defaults to 21.
Description
Connect to a server and send the commands to authenticate a session.
Syntax
Visual Basic
Public Sub Login( _
   Optional ByVal RemoteName As String, _
   Optional ByVal User As String, _
   Optional ByVal Password As String, _
   Optional ByVal Account As String, _
   Optional ByVal RemotePort As Long = 0 _
) 
Parameters
RemoteName
Optional. Specifies the hostname or IP address of the server.
User
Optional. Specifies a user name for an account on the server.
Password
Optional. Specifies the account password associated with User.
Account
Optional. Specifies an account on the server.
RemotePort
Optional. Specifies the remote port to connect to. Defaults to 21.
Remarks

If RemoteName is specified and State is not tcpClosed, then the existing session is immediately aborted.

If RemoteName is specified, then a connection is attempted. The State event fires if it succeeds; otherwise, the Error event fires.

If RemoteName is not specified and State is not tcpConnected, then a ptNotConnected error is generated. If RemoteName is not specified and State is tcpConnected, then a ftpReinitialize command is sent to prepare the server to authenticate again.

Once connected and ready to authenticate, the ftpUser, ftpPassword, and ftpAccount commands are sent to the server.

If Timeout is greater than 0, Login blocks until authentication is complete, an error occurs, or a ptTimeout error occurs. If Timeout is 0, Login immediately returns and the Progress event fires multiple times as each server reply is received.

Error Codes

This method may generate the following error code (refer to ErrorConstants for a complete list of error codes):

Example
This VB example shows how to perform an ftp login.
Private Sub Command1_Click()
	On Error GoTo OnError ' use intrinsic error handling
	Ftp1.Login "ftp.dart.com", "anonymous", "powertcp"
	If Ftp1.State = tcpConnected Then MsgBox "Connected!"
	Exit Sub
OnError: ' Any error jumps here
	Debug.Print "Error #" + CStr(Err.Number) + ": " + Err.Description
End Sub
See Also

Ftp Object  | Ftp Members


PowerTCP FTP for ActiveX Documentation Version 2.2
© 2018 Dart Communications. All Rights Reserved.
Send comments on this topic