INT EnumClients( |
|
UINT * lpClients, |
|
|
INT nMaxClients |
|
); |
Return a list of active
client connections established with the server.
Parameters
- lpClients
- Pointer to an array of unsigned integers which will contain
client IDs that uniquely identifies each client when the method
returns. If this parameter is NULL, then the method will
return the number of active client connections established with
the server.
- nMaxClients
- Maximum number of client IDs to be returned in the lpClients
array. If the lpClients parameter is NULL, this parameter
should have a value of zero.
Return Value
If the method succeeds, the return value is the number of active
client connections to the server. If the method fails, the return
value is FTP_ERROR. To get extended error information, call
GetLastError.
Remarks
If the nMaxClients parameter is less than the number of
active client connections, the method will fail and the last error
code will be set to the error ST_ERROR_BUFFER_TOO_SMALL. To
dynamically determine the number of active connections, call the
method with the lpClients parameter with a value of NULL,
and the nMaxClients parameter with a value of zero.
Example
// Populate a listbox with all of the users connected to the server
pListBox->ResetContent();
INT nClients = pFtpServer->EnumClients();
if (nClients > 0)
{
UINT *pIdList = new UINT[nClients];
nClients = pFtpServer->EnumClients(pIdList, nClients);
if (nClients == FTP_ERROR)
{
// Unable to obtain list of connected clients
return;
}
for (INT nIndex = 0; nIndex < nClients; nIndex++)
{
CString strUserName;
if (pFtpServer->GetClientUserName(pIdList[nIndex], strUserName))
pListBox->AddString(strUserName);
}
// Free the memory allocated for the client IDs
delete pIdList;
}
Requirements
Minimum Desktop Platform: Windows 7 (Service Pack 1)
Minimum Server Platform: Windows Server 2008 R2 (Service Pack 1)
Header File: cstools10.h
Import Library: csftsv10.lib
See Also
GetClientAddress,
GetClientDirectory,
GetClientUserName
|