473,666 Members | 2,116 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using the FtpCommand function in wininet.dll

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
Nov 16 '05 #1
3 4065
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]
- mv*@spam.guard. caspershouse.co m

"gnanib" <gb***@lutron-dot-com.no-spam.invalid> wrote in message
news:40******** **@Usenet.com.. .
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

Nov 16 '05 #2
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" <gb***@lutron-dot-com.no-spam.invalid> wrote in message
news:40******** **@Usenet.com.. .
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

Nov 16 '05 #3
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("wini net.dll", CharSet = CharSet.Auto)]
public static extern bool FtpCommand(IntP tr hConnect, bool
fExpectResponse , ulong ulFlags, string dwFlags, IntPtr dwContext, ref
IntPtr phFtpCommand);

// Declaration of variables to be used in function
IntPtr hInternetSessio n = new IntPtr(0); //handle to the Internet
session
IntPtr hInternetConnec tion = new IntPtr(0); //handle to the Internet
connection
IntPtr hInternetString = new IntPtr(0);
IntPtr hInternetTest = new IntPtr(0);

// hInternetSessio n and hInternetConnec tion 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.FtpComma nd(hInternetCon nection, false, FTP_TRANSFER_TY PE_ASCII,
"ALLO 4156" , hInternetTest, ref hInternetString ))
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
9396
by: Dan | last post by:
I have an app that uses the wininet.dll APIs to get web pages and to post to web forms. My problem is that some of my users systems will literally wait an hour before an Internet call to a site that isn't responding times out. During this time the app appears to hang since it won't do anything until it gets a response to the HTTP request. Does anyone know of a way to enforce a time out on calls to wininet? I have read of setting registry...
1
4472
by: Sean Barnes | last post by:
Hello all, I am having a bit a problem with the InternetDial function in the wininet.dll. The problem is that despite passing in a null terminated string as the lpszConnectoid param to the function it simply picks the top connection in an alphanumerically sorted list obtained from the rasapi32.dll RasEnumEntries function.
3
3718
by: Rich | last post by:
Greetings, I have a VB6 app that uses API's from wininet.dll for FTP- ing textfiles to and from Mainframe computers and doing directory searches on the mainframe from a windows desktop computer, etc. I want to migrate this app to C#. So before I start re-inventing the wheel (with InteropServices) can C# perform FTP operations like wininet.dll? If so, could someone point me (or show me) some examples of how to do this? If not, I...
9
3307
by: Ron | last post by:
Hello, Is it required to use Imports System.Runtime.InteropServices to run C++ API code? I ask because I thought I read somewhere that this was required. If it is not required would it interfere if I added it? I experimented with a simple API
0
979
by: Sankalp | last post by:
Hi, I am tryin to create an internet connection and download a particular file from a specified URL programmatically using VB on a WIN 95 machine. The code that I use is as follows: Private Const INTERNET_OPEN_TYPE_PRECONFIG = 0 Private Const INTERNET_OPEN_TYPE_DIRECT = 1 Private Const INTERNET_OPEN_TYPE_PROXY = 3
0
3308
by: Nishini | last post by:
I am using "FtpFindFirstFile" function of wininet.dll in my application. I had the Declare statement for this function in my code but when I executed my applicaiton, it gave me an error saying "Unable to find the entry point for FtpFindFirstFile in the DLL wininet.dll". Then, instead of Declare, I used <DllImport("wininet.dll">Public Shared Function FtpFindFirstFile..... End Function - which is a dummy implementation. Then, I got that error...
13
3504
by: Javad | last post by:
Hello I know that I should get the information of windows internet connections by using "rasapi32.dll" library, and I also have some sample codes, but I can't make them work. My exact need is to get the "UserName" of a connection. How is it possible? plz hlp thnk u
10
3191
by: =?Utf-8?B?TWF0dA==?= | last post by:
I am using the following code to connect to and download files from an ftp server, but the Symantec anti-virus software on some of my customers machines tells them that their computers are attacking the Ftp server with "FTP Pathname Glob BO". See the following link for more info: http://www.symantec.com/avcenter/attack_sigs/s20430.html This is standard .Net code, so I'm not understanding why it would trigger such a response. Also,...
1
3867
by: douglandmesser | last post by:
Hey guys. I need a little help uploading from VB6. I've done all of the leg work, but I need the last little bit of help. My current code is below: Const INTERNET_SERVICE_FTP = 1 Const INTERNET_OPEN_TYPE_DIRECT = 1 Const INTERNET_FLAG_PASSIVE = &H8000000 Const FTP_TRANSFER_TYPE_BINARY = 0 Const FILE_ATTRIBUTE_ARCHIVE = &H20 Private Declare Function InternetOpen Lib "wininet.dll" Alias "InternetOpenA" (ByVal sAgent As String, ByVal...
0
8445
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8356
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8640
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7386
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6198
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5664
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4198
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4369
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1776
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.