 |
|
|
Hello
If you search a comfortable and reusable FTP client,
-- which is running on .NET Framework 1.1 or higher, -- which can automatically put together splitted files on the server, -- which allows to download only a part of a file on the server, -- which allows to resume any broken download, -- which automatically starts a separate thread, -- which can be aborted any time from your main thread, -- which supports UTF8 encoded filenames, -- which has a built-in download scheduler, -- which has a built-in bandwidth control, -- which has a built-in preview function for the download of movies, -- which automatically reconnects the server after an error has occurred, -- which displays download progress in percent and in bytes and the remaining time, -- which writes a detailed logging for all operations it does, -- which is based on Wininet.dll and has one workaround for each of the 4 known Wininet.dll bugs, -- which is very well tested and bug-free, -- which is written by a very experienced programmer and has a very clean and well documented sourcecode,
then have a look at this project:
ElmueSoft Partial FTP Downloader[^]
Elmü
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Hello, I'm searching an FTP library, in .NET, which allows sending such a command as of Subject. Yours, can?
|
| Sign In·View Thread·PermaLink | 1.80/5 (2 votes) |
|
|
|
 |
|
|
funFTPFirstFile() works quit well, but does anybody has an idea how to get every file of a directory and not only the first one?
|
| Sign In·View Thread·PermaLink | 2.00/5 (2 votes) |
|
|
|
 |
|
|
//use InternetFindNextFile [DllImport("wininet.dll", CharSet = CharSet.Auto)] public static extern bool InternetFindNextFile(IntPtr hFind,[In,Out] FileData dirData);
|
| Sign In·View Thread·PermaLink | 2.00/5 (1 vote) |
|
|
|
 |
|
|
should be something like:
[DllImport("wininet.dll", CharSet = CharSet.Auto)] //public static extern bool InternetFindNextFile(ulong ulFindFirst, [In, Out] FileData dirData); public static extern bool InternetFindNextFile(IntPtr ulFindFirst, [In, Out] FileData dirData);
... IntPtr hFind = new IntPtr(0); ... public Hashtable funGetFilesInDir(string strPath) { string strFileName = ""; Hashtable fileList = new Hashtable(); try { strFileName = funFTPFirstFile(strPath); if (strFileName.Equals("")) { fileList = null; } else { do { Console.WriteLine(myFileData.fileName); fileList.Add(myFileData.fileName, myFileData.fileAttributes); } while (InternetFindNextFile(hFind, /*(LPVOID) & */ myFileData)); } return fileList; } catch (Exception e) { fileList = null; if (bolDebug) Console.WriteLine(e.Message); throw e; //pass this exception back to the caller } }
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Anyone interested to use this code in a .Net 2 environment should replace "ulong" with "uint" because the .Net CLR detects incorrect function mappings and throws PInvokeStackImbalance exceptions. in my experience none of the FTP functions will work without this change.
hope this helps anybody else out there who encounteres the same problem. tim.
|
| Sign In·View Thread·PermaLink | 5.00/5 (6 votes) |
|
|
|
 |
|
|
 |
|
|
Thank you very much for this comment. I appreciate the code but it just doesn't work and doesn't give a decent error code to understand. After changing ulong to uint, everything works perfect. Thank you very much.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
 |
|
|
In public bool funGetError() case 12003: //ERROR_INTERNET_EXTENDED_ERROR
call to InternetGetLastResponseInfo _OVERWRITES_ (zeroes) the value of intErrorValue. There are 2 such calls. That's why in such cases funGetError() returnes FALSE.
I do not think this is by design. To fix, just add uint intErrorValue = 0; as a first line in the try block.
Otherwise it as workable solution. At least can be used as starting point for ftp file manipulation from .net.
BTW, NET 2.0 introduces ftp client functionality, but some pieces are still missing. So I concider Wininet a better solution.
Lev Elbert
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Here is the flag you need to add to put WinInet in passive mode
uint flags = 0x08000000; //INTERNET_FLAG_PASSIVE;
hInternetConnection = FtpDll.InternetConnect(hInternetSession, strHostURL, FtpDll.DEFAULT_FTP_PORT, strUser, strPW, FtpDll.SERVICE_FTP, flags, 0);
http://www.adamloving.com
|
| Sign In·View Thread·PermaLink | 5.00/5 (1 vote) |
|
|
|
 |
|
|
Hi! The client worked perfectly for mi when I tryed it in a lan without a proxy that shares the connection. Now, in the other scenario (with the proxy between my Lan and Internet) I got the "funIConnect failed, error value: 3" when funIConnect method executes. So, It worked in a machine connected directly to internet, but did not work in other in a LAN with an internet proxy. I have to set the gateway or something like that ?
Thanks in advance. alvaro
|
| Sign In·View Thread·PermaLink | 2.75/5 (4 votes) |
|
|
|
 |
|
|
According to the Win32 SDK, 3 has to do with "Path not found" ... I changed the hostname (in my case "localhost" was not quite working out for me!) to an IP address (127.0.0.1) and it worked just fine ... stupid problem, stupid solution ... but hey, I'm just happy that it works ... try something that would resolve properly ... as a last ditch effort, try the IP address.
|
| Sign In·View Thread·PermaLink | 1.83/5 (3 votes) |
|
|
|
 |
|
|
 |
|
|
Can anybody suugest how can we implement the connection timeout while it try to connect with ftp server. As we know there is property exposed by winInet API to set the connection timeout.
|
| Sign In·View Thread·PermaLink | 2.00/5 (6 votes) |
|
|
|
 |
|
|
Hello. I am trying to use the wininet.dll to automate transfer of schedule files to a machine that performs operations based on those schedule files. The box seems to lock the files after it loads them. When I try to FTP the new schedule with the same name as the old, it will fail due to the file being locked. (Note that the wininet error handling does not generate an error, but I have an error logging program running on my FTP server that tells me this is why the operation failed). If I reboot my ftp server, I can then ftp the new file. Does the wininet.dll have any convention for overwriting a file that is locked on an ftp server? I haven't seen anything in the Microsoft documentation.
Thanks, Kevin
|
| Sign In·View Thread·PermaLink | 1.33/5 (3 votes) |
|
|
|
 |
|
|
 |
|
|
 |
|
|
Everything working fine with FtpClient except FtpCommand . i want to list a dir content by sending "NLST" using FtpCommand but unfortunately no example given on FtpCommand and when i tried it giving me error everytime. I will appreciate if some example can be given on FtpCommand for using NLST and LIST commands.
|
| Sign In·View Thread·PermaLink | 5.00/5 (2 votes) |
|
|
|
 |
|
|
I finally got it to work. I coded it as follows:
[DllImport("wininet.dll", CharSet = CharSet.Auto)] public static extern bool FtpCommand(IntPtr ulSession, bool fExpertREsponse, [MarshalAs(UnmanagedType.U4)] int dwFlags, string lpszCommand, IntPtr dwContext, ref IntPtr phFtpCommand);
I changed the follwowing FTP transfer flags to int instead of uint. public const int FTP_TRANSFER_TYPE_ASCII = 1; public const int FTP_TRANSFER_TYPE_BINARY = 2;
Added the variables: IntPtr hInternetString = new IntPtr(0); IntPtr hInternetTest = new IntPtr(0);
And coded the procedure as: public void funFTPCommand(string fCmd) { try { if (!funIConnected()) throw new Exception("Please connect to FTP host first!"); funClearError(); //clear the 'last error' value FtpDll.FtpCommand(hInternetConnection, false, FTP_TRANSFER_TYPE_ASCII, fCmd, hInternetTest, ref hInternetString); if (funGetError()) throw new Exception("funFTPCommand failed, error value: " + intErrorValue + " - " + strErrorText); } catch (Exception e) { if (bolDebug) Console.WriteLine(e.Message); throw e; //pass this exception back to the caller } }
|
| Sign In·View Thread·PermaLink | 4.00/5 (2 votes) |
|
|
|
 |
|
|
 |
|
|
Can any one help me to make an application in assembly language that send (post) data to an internet server. Thanksssssssss in advance.
Zeeshan
|
| Sign In·View Thread·PermaLink | 1.00/5 (1 vote) |
|
|
|
 |
|
|
 |
|
|
hi, just replying to my own post for other peoples information... it does work on a clean win 98 (not SE) install. the versions of wininet.dll are different but it runs ok still.
tim
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |