May 01, 2024, 03:38:06 PM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Having trouble with FtpCommand and getting errors

Started by myql, March 13, 2009, 05:09:46 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

myql

I'm trying to do what I expect are straight-forward things with FTP, but somehow I'm not understanding some things.
I am able to do
  hInet = InternetOpen(sAgent, INTERNET_OPEN_TYPE_PRECONFIG, "", "", 0)
and
  hInetConnection = InternetConnect( _
         hInet, _
         "www.thisIsaNobodysSite.com", _
         INTERNET_DEFAULT_FTP_PORT, _
         "aUser", _
         "aPassword", _
         INTERNET_SERVICE_FTP, _
         INTERNET_FLAG_PASSIVE, _
         0)
Of course, the site/user/password are changed.
[and what is passive connection about--should I use something else?]

And I can successfullyI do
  gotDir = FtpGetCurrentDirectory( hInetConnection, sDir, dirLen)
sDir gets "/" as expected.

But when I try
  bSuccess = FtpCommand( _
      hInetConnection, _
      1, _
      FTP_TRANSFER_TYPE_ASCII, _
      S2W("ls"), _
      0, _
      hResponse )
I get hResponse, but bSuccess = 0, and when I GetLastError() it is also 0.
[MSDN talks about TCHARs so I assume that means using WSTRING, but I've tried just "ls" as well]
Also, what is hResponse? MSDN just says "a handle that is created if a valid data socket is opened".
Is that a socket? Do I treat it like a file handle?

Sorry if I'm so confused. Maybe this is the wrong forum to even ask this?