Connecting Tech Pros Worldwide Forums | Help | Site Map

Using the FtpCommand function in wininet.dll

gnanib
Guest
 
Posts: n/a
#1: Nov 16 '05
I am writing an FTP client in C# with the help of the functions
available in wininet.dll. I was able to get everything to work
except the use of the "FtpCommand" function. Basically I am trying
to issue the "ALLO" command to a server, but the ALLO command is not
availabe in wininet.dll. Therefore I have to use the FtpCommand.
I was wondering if anyone was able to successfully use this command in
C# to send out strings to a FTP server/client, and if so who to use
it. I keep getting error #87 back, which is an error indicating
incorrect parameters.


Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com

Nicholas Paldino [.NET/C# MVP]
Guest
 
Posts: n/a
#2: Nov 16 '05

re: Using the FtpCommand function in wininet.dll


gnanib,

Errors of this type usally stem from the declaration. Check the
declaratio of FtpCommand that I've placed on Pinvoke.net and see if they
match.

If they do, then can you show how you are calling the API?


--
- Nicholas Paldino [.NET/C# MVP]
- mvp@spam.guard.caspershouse.com

"gnanib" <gbala@lutron-dot-com.no-spam.invalid> wrote in message
news:40cdf6e1$1_2@Usenet.com...[color=blue]
> I am writing an FTP client in C# with the help of the functions
> available in wininet.dll. I was able to get everything to work
> except the use of the "FtpCommand" function. Basically I am trying
> to issue the "ALLO" command to a server, but the ALLO command is not
> availabe in wininet.dll. Therefore I have to use the FtpCommand.
> I was wondering if anyone was able to successfully use this command in
> C# to send out strings to a FTP server/client, and if so who to use
> it. I keep getting error #87 back, which is an error indicating
> incorrect parameters.
>
>
> Posted Via Usenet.com Premium Usenet Newsgroup Services
> ----------------------------------------------------------
> ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
> ----------------------------------------------------------
> http://www.usenet.com[/color]


Andrew b.
Guest
 
Posts: n/a
#3: Nov 16 '05

re: Using the FtpCommand function in wininet.dll


An identical message has been posted to csharphelp.com. I connected via
command line to both Microsoft and Linux FTP servers and ALLO seems to be a
bad command....

"gnanib" <gbala@lutron-dot-com.no-spam.invalid> wrote in message
news:40cdf6e1$1_2@Usenet.com...[color=blue]
> I am writing an FTP client in C# with the help of the functions
> available in wininet.dll. I was able to get everything to work
> except the use of the "FtpCommand" function. Basically I am trying
> to issue the "ALLO" command to a server, but the ALLO command is not
> availabe in wininet.dll. Therefore I have to use the FtpCommand.
> I was wondering if anyone was able to successfully use this command in
> C# to send out strings to a FTP server/client, and if so who to use
> it. I keep getting error #87 back, which is an error indicating
> incorrect parameters.
>
>
> Posted Via Usenet.com Premium Usenet Newsgroup Services
> ----------------------------------------------------------
> ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
> ----------------------------------------------------------
> http://www.usenet.com[/color]


gnanib
Guest
 
Posts: n/a
#4: Nov 16 '05

re: Using the FtpCommand function in wininet.dll


I tried using your (Nicholas) declaration, but I still have problems.
Here is what I am doing. Please let me know what I am doing wrong:

// The declaration
DllImport("wininet.dll", CharSet = CharSet.Auto)]
public static extern bool FtpCommand(IntPtr hConnect, bool
fExpectResponse, ulong ulFlags, string dwFlags, IntPtr dwContext, ref
IntPtr phFtpCommand);

// Declaration of variables to be used in function
IntPtr hInternetSession = new IntPtr(0); //handle to the Internet
session
IntPtr hInternetConnection = new IntPtr(0); //handle to the Internet
connection
IntPtr hInternetString = new IntPtr(0);
IntPtr hInternetTest = new IntPtr(0);

// hInternetSession and hInternetConnection are
// initialized when a connection to a server
// is made.
// I am not sure what to do with hInternetTest and
// and hInternetString.

// Use of function
FtpDll.FtpCommand(hInternetConnection, false, FTP_TRANSFER_TYPE_ASCII,
"ALLO 4156" , hInternetTest, ref hInternetString))


Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Closed Thread