| |
| INT WINAPI FtpLogin(
|
| |
HCLIENT hClient, |
|
| |
LPCTSTR lpszUsername, |
|
| |
LPCTSTR lpszPassword, |
|
| |
LPCTSTR lpszAccount |
|
| );
|
The FtpLogin function authenticates the specified user in
on the server. This function must be called after the connection
has been established, and before attempting to transfer files or
perform any other function on the server.
Parameters
- hClient
- Handle to the client session.
- lpszUsername
- Points to a null-terminated string that specifies the user name
to be used to authenticate the current client session. If this
parameter is NULL or an empty string, then the login is considered
to be anonymous.
- lpszPassword
- Points to a null-terminated string that specifies the password
to be used to authenticate the current client session. This
parameter may be NULL or an empty string if no password is required
for the specified user, or if no username has been specified.
- lpszAccount
- Points to a null-terminated string that specifies the account
name to be used to authenticate the current client session. This
parameter may be NULL or an empty string if no account name is
required for the specified user.
Return Value
If the function succeeds, the return value is the server result
code. If the function fails, the return value is FTP_ERROR. To get
extended error information, call FtpGetLastError.
Remarks
Some public FTP servers support anonymous logins, where a
username and password are not required to access the server. In
this case, both the lpszUserName and lpszPassword
parameters can be NULL or specify empty strings. In most cases,
access to the server using an anonymous login is restricted, with
clients only having permission to download files. Servers may also
restrict the maximum number of anonymous sessions that may be
logged in at one time.
This function should only be used after calling the
FtpLogout function, enabling you to log in as another user
during the same session. Not all servers will permit a client to
change user credentials during the same session. In most cases, it
is preferable to disconnect from the server and re-connect using
the new credentials rather than using this function.
Requirements
Client: Requires Windows 7, Windows Vista or Windows
XP.
Server: Requires Windows Server 2008 or Windows Server
2003.
Header: Include cstools7.h.
Library: Use csftpav7.lib.
Unicode: Implemented as Unicode and ANSI versions.
See Also
FtpAccount, FtpConnect, FtpLogout, FtpPassword, FtpProxyConnect, FtpUsername
|
|