raykos
2004-10-04 19:11:04 UTC
Hello all,
Trying to develop an FTP app using WinInet commands.
My session, callback declaration & connection:
//Create the Internet session, using global handles so they can be
//seen by the callback
g_hSession = InternetOpen("TestWinInet",
INTERNET_OPEN_TYPE_PRECONFIG,
NULL, NULL,
INTERNET_FLAG_ASYNC);
if (g_hSession)
{
INTERNET_STATUS_CALLBACK dwStatusCallback;
dwStatusCallback = InternetSetStatusCallback(g_hSession,
MyStatusCallback);
if (INTERNET_INVALID_STATUS_CALLBACK == dwStatusCallback)
{
AfxMessageBox("Error status callback");
}
}
//make the connection
g_hConnection = InternetConnect(g_hSession, sServer,
INTERNET_DEFAULT_FTP_PORT,
sDestUser,sDestPwd,
INTERNET_SERVICE_FTP,
INTERNET_FLAG_PASSIVE ,
CONNECT_CONTEXT);
If I do not use 'INTERNET_FLAG_ASYNC' , wait for a valid 'g_hConnection,
and then do a 'FtpPutFile(....)', it seems to work.
But, if I do use 'INTERNET_FLAG_ASYNC', and wait for the callback,
case INTERNET_STATUS_REQUEST_COMPLETE:
{
//use function to put file
}
then try to do a 'FtpPutFile(...)' I get an error code of "997",
' overlapped I/O operation in progress'?? What overlapped?
The 'g_hConnection' is valid, and I don't know where to go from here??
I would like to do FTP asynchronously, but I sure am having trouble with
the
callback. Even when I use FtpCommand with 'NLST', the command is xmitted
but it just seems to wait for a data port to be opened?
So, if anybody could tell me or show me how to properly use the callback,
I would appreciate it?
TIA,
Ray K.
Trying to develop an FTP app using WinInet commands.
My session, callback declaration & connection:
//Create the Internet session, using global handles so they can be
//seen by the callback
g_hSession = InternetOpen("TestWinInet",
INTERNET_OPEN_TYPE_PRECONFIG,
NULL, NULL,
INTERNET_FLAG_ASYNC);
if (g_hSession)
{
INTERNET_STATUS_CALLBACK dwStatusCallback;
dwStatusCallback = InternetSetStatusCallback(g_hSession,
MyStatusCallback);
if (INTERNET_INVALID_STATUS_CALLBACK == dwStatusCallback)
{
AfxMessageBox("Error status callback");
}
}
//make the connection
g_hConnection = InternetConnect(g_hSession, sServer,
INTERNET_DEFAULT_FTP_PORT,
sDestUser,sDestPwd,
INTERNET_SERVICE_FTP,
INTERNET_FLAG_PASSIVE ,
CONNECT_CONTEXT);
If I do not use 'INTERNET_FLAG_ASYNC' , wait for a valid 'g_hConnection,
and then do a 'FtpPutFile(....)', it seems to work.
But, if I do use 'INTERNET_FLAG_ASYNC', and wait for the callback,
case INTERNET_STATUS_REQUEST_COMPLETE:
{
//use function to put file
}
then try to do a 'FtpPutFile(...)' I get an error code of "997",
' overlapped I/O operation in progress'?? What overlapped?
The 'g_hConnection' is valid, and I don't know where to go from here??
I would like to do FTP asynchronously, but I sure am having trouble with
the
callback. Even when I use FtpCommand with 'NLST', the command is xmitted
but it just seems to wait for a data port to be opened?
So, if anybody could tell me or show me how to properly use the callback,
I would appreciate it?
TIA,
Ray K.