|
 |
|
|
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 | |
|
|
|
 |
|
|
my server which i must to connect is "xxx.xxx.xxx.xxx\folder", and i can not use
---- Session.Server = "xxx.xxx.xxx.xxx\folder"; Session.Connect(username, password); ----
Exception is "No such host is know"
Please help me...thanks for advance
prayoon
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
Ok
I found solution 
http://www.nsftools.com/tips/RawFTP.htm#MKD
internal void MKDIR(string dirname) { FtpCommand("MKD " + dirname); if (m_lastResponse.Code != 257) throw new FtpException("Cannot create !!! directory. + Error Code" + m_lastResponse.Code.ToString(), m_lastResponse);
... }
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Very useful tool but i cant get the parent directory as it is always null. Can you help please?
|
| Sign In·View Thread·PermaLink | 1.00/5 (1 vote) |
|
|
|
 |
|
|
I want to move a existing file from one folder to another folder in FTP.Can any body give logic or atleast suggestions.
Chandu.Sanka
|
| Sign In·View Thread·PermaLink | 1.00/5 (2 votes) |
|
|
|
 |
|
|
Hi
i am downloading a file from ftp programitically in ASP.NET using c#.and i am unable to trace the target directory in which the file is stored
i want to trace the target location directory where the file is downloaded.
chandu.sanka
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Hello,
It seems to be a great project ! Congratulations !
But in the testApplication, kcommon.dll is required and I don't find it. Could you tell me how to proceed in order to download it ot to make it ?
If I build the kcommon project, I've got an error on [assembly: AssemblyVersion("1.0.*.*")] AssemblyInfo.cs(31): Error emitting 'System.Reflection.AssemblyVersionAttribute' attribute -- 'The version specified '1.0.*.*' is invalid'
and private Session ftpSession; MainForm.cs(17): The type or namespace name 'Session' could not be found (are you missing a using directive or an assembly reference?)
Thanks for your help.
|
| Sign In·View Thread·PermaLink | 1.25/5 (4 votes) |
|
|
|
 |
|
|
OK I have found an answer in another post :
====================================== Re: Error trying to build [Click for User Profile] Alex Kwok 0:18 2 Jun '02 Oh sorry, it's my mistake. Change 1.0.*.* to 1.0.* will solve the error. [Reply | Email | View Thread | Get Link] Rate this message: 1 2 3 4 5 (out of 5) Report as Spam or Abuse ======================================
Good job !
Bye
|
| Sign In·View Thread·PermaLink | 2.50/5 (6 votes) |
|
|
|
 |
|
|
i want to download a zip file from FTP server using Visual Studio 2003 in ASP.NET. Kindly help
regards Raju sharma
|
| Sign In·View Thread·PermaLink | 1.80/5 (2 votes) |
|
|
|
 |
|
|
I m trying to upload a file into ftp.It gives msg "Could not find File name'xyz.txt'". Can u suggest what changes i have to make if file doen not exist in ftp server. So as to upload new files into it.
regards, preet
|
| Sign In·View Thread·PermaLink | 2.00/5 (4 votes) |
|
|
|
 |
|
|
Thanks Alex - The class is fantastic for newbies like me.
This may sound a little stupid, i hope someone can help.
I have a loop here which look throught all directory in the remote server then copy the file via FTP to local PC, and then once copied the loop will make a copy of itself with a different name in the remote server. The code looks like this, I can get it to FTP but not copy itself in the remote server, I guess i have problem understanding how steams works on the remote server.
foreach(FtpFile f in d.Files) { //this line downloads the file to localPC d.GetFile(f.Name.ToString());
ReadStream1 = f.GetOutputStream(); WriteStream1 = ftpSession.CurrentDirectory.CreateFileStream (f.Name.ToString()+".BU");
while ((readed=ReadStream1.Read(buff, 0, 4096))!=0) WriteStream1.Write(buff, 0, readed);
ReadStream1.Close(); WriteStream1.Close(); }
Can some advise what the problem is?
Many Thanks
Best Regards Jason
Life is a search.
|
| Sign In·View Thread·PermaLink | 2.00/5 (1 vote) |
|
|
|
 |
|
|
It looks like you are simply overwriting the downloaded file into the current directory on the FTP server. Change your directory then write the stream back.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Great component Alex - awesome work!! 
I noticed that the UNIX regex's were failing to recognise some files and directories that were returned by the FTP server, specifically the following patterns weren't being matched in MatchingListLine()
-rw-r--r-- 1 500 500 251805 May 3 16:53 filename.txt drwxr-xr-x 7 root root 4096 Apr 11 15:47 dirname
Here's the fix - in FtpDirectory change implement the following 4 regex's:
#region Regular expression to parse list lines static Regex m_UnixListLineExpression1 = new Regex(@"(?<dir>[\-d])(?<permission>([\-r][\-w][\-xs]){3})\s+\d+\s+\w+\s+\w+\s+(?<size>\d+)\s+(?<timestamp>\w+\s+\d+\s+\d{4})\s+(?<name>.+)"); static Regex m_UnixListLineExpression2 = new Regex(@"(?<dir>[\-d])(?<permission>([\-r][\-w][\-xs]){3})\s+\d+\s+\w+\s+\w+\s+(?<size>\d+)\s+(?<timestamp>\w+\s+\d+\s+\d{2}:\d{2})\s+(?<name>.+)"); static Regex m_UnixListLineExpression3 = new Regex(@"(?<dir>[\-d])(?<permission>([\-r][\-w][\-xs]){3})\s+\d+\s+\d+\s+(?<size>\d+)\s+(?<timestamp>\w+\s+\d+\s+\d{4})\s+(?<name>.+)"); static Regex m_UnixListLineExpression4 = new Regex(@"(?<dir>[\-d])(?<permission>([\-r][\-w][\-xs]){3})\s+\d+\s+\d+\s+(?<size>\d+)\s+(?<timestamp>\w+\s+\d+\s+\d{2}:\d{2})\s+(?<name>.+)"); static Regex m_DosListLineExpression = new Regex(@"(?<timestamp>\d{2}\-\d{2}\-\d{2}\s+\d{2}:\d{2}[Aa|Pp][mM])\s+(?<dir>\<\w+\> {0,1}(?<size>\d+){0,1}\s+(?<name>.+)"); #endregion
... and modify MatchingListLine as follows:
private Match MatchingListLine(string line) { Match m = m_UnixListLineExpression1.Match(line); if(m.Success) return m; m = m_UnixListLineExpression2.Match(line); if(m.Success) return m; m = m_UnixListLineExpression3.Match(line); if(m.Success) return m; m = m_UnixListLineExpression4.Match(line); if(m.Success) return m; m = m_DosListLineExpression.Match(line); if(m.Success) return m;
return null; }
Also, the working directory after logging in to an FTP server may not be the user's root - it may be possible to navigate up past it. The following code change allows the user to do this using FtpDirectory.Parent
public FtpDirectory Parent { get { CheckSessionCurrentDirectory(); //if(m_fullPath == m_session.RootDirectory.m_fullPath) // return null; if(m_fullPath == "/") return null;
<...snip...>
return parent; } }
Thanks
|
| Sign In·View Thread·PermaLink | 5.00/5 (1 vote) |
|
|
|
 |
|
|
Hello. My english is not very good but i ll try to be clear. I found Kcommon.dll very useful and i need it to create a vb .NET application. My programmin skills are not the best. So i faced the problem with directory listing... Not all files and directories are listed. I try connection to linux boxes. I downloaded the code but i dont know how to change this and recompile to .NET dll file so to use it to my application...
Could you help me / give me clear instructions...
I would appreciate a lot your offer.
Thanks.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
I am trying to use this library in my vb.net application. My Code is as follow:
Private Sub Form_Load() Private ftpsession As New Session
Dim files As String Dim count As Integer
Dim rootdir As FtpDirectory ftpsession.Server = "000.00.0.00" ftpsession.Connect("User1", "test") ftpsession.ChangeDirectory("Folder1")
rootdir = ftpsession.CurrentDirectory
count = rootdir.Files.Count
For Each file As FtpFile In ftpsession.CurrentDirectory.Files files += file.Name & " - " Next Label1.Text += " Folder : " & rootdir.Name Label1.Text += " >> Files : " & files & "----------- || "
End Sub
I already insert the function "ChangeDirectory()" in FTPSession.cs Class like this..
public bool ChangeDirectory(string Pathname) { try { m_state.ControlChannel.CWD(Pathname); m_state.CurrentDirectory.ForceCWDUpdate(); FtpDirectory fDir = new FtpDirectory((SessionConnected)m_state); m_state.CurrentDirectory = fDir; m_state.CurrentDirectory.InitHashtable(); return true; } catch (Exception e) { return false; } }
And also already copyed the following function in FTPDirectory.cs Class.
public void ForceCWDUpdate() { m_fullPath = m_session.ControlChannel.PWD(); if(m_fullPath == "/")
{ m_name = m_fullPath; return; }
string[] directories = m_fullPath.Split('/'); m_name = directories[directories.Length-1]; m_fullPath += "/";
}
And write these following lines in "MatchingListLine" Function in the FTPDirectory.cs Class
m = m_UnixListLineExpression3.Match(line); if(m.Success) return m;
My program can get files from the currentdirectory when I trying to connect to the FTP server within our LAN.
But I cannot connect to the the other FTP server over the Internet. I break at this line: f = ftpsession.ChangeDirectory("TEST1")
At that time :
?ftpsession.IsConnected True ?ftpsession.RootDirectory.Files.Count Run-time exception thrown : KCommon.Net.FTP.FtpException - Failed to open data connecton.
What I need to change? Any Idea? Please help me. I am in a tough situation.
Thansks..
Star9999
-- modified at 23:04 Thursday 20th April, 2006
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
I am trying to change the directory and using the following code
ftpSession.CurrentDirectory = ftpSession.CurrentDirectory.FindSubdirectory("somedir");
It works fine if the somedir is a normal dir but in my case it is a virtual folder and I am getting an error there. Is there any other way to change the directory.
Thanks
coder
|
| Sign In·View Thread·PermaLink | 2.80/5 (5 votes) |
|
|
|
 |
|
|
Hi, I am very interested in this. ButHow come i can't download the demo file? Thanks.
Henson
|
| Sign In·View Thread·PermaLink | 2.00/5 (1 vote) |
|
|
|
 |
|
|
I m trying to upload a file into ftp.It gives msg "Could not find File name'xyz.txt'". Can u suggest what changes i have to make if file doen not exist in ftp server. So as to upload new files into it.
Good Work..
Happy Coding "San"
|
| Sign In·View Thread·PermaLink | 2.00/5 (1 vote) |
|
|
|
 |
|
|
I'm rookie programmer, and I try to code FTP by VB.NET. And I have some problem in GetFile From FTP follow this code
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim ServFile As String = "TEST.ini" Dim ServName As String = "192.168.1.148" Dim User As String = "Test" Dim Pass As String = "Test"
Try
mftp = New KCommon.Net.FTP.Session mftp.Server = (ServName) mftp.Port = 21 mftp.Connect(ServUser, ServPass)
mftp.CurrentDirectory.CreateFile("b.txt") ' Work
mftp.CurrentDirectory.PutFile("c.txt") 'Work
mftp.CurrentDirectory.BeginGetFile(ServFile) ' It not Work and have message ' "ex.Message"Remote file (TEST.ini) not found. ' Try refresh the directory." String" Catch ex As Exception MsgBox(ex.Message)
End Try End Sub
Thanks a lot for Ur Help.
|
| Sign In·View Thread·PermaLink | 2.00/5 (2 votes) |
|
|
|
 |
|
|
try something like :
FtpFile RemoteFile = mftp.CurrentDirectory.FindFile(ServFile);
if (RemoteFile != null) { FtpInpuDataSream Stream = RemoteFile.GetInputStream() }
or :
mftp.CurrentDirectory.Refresh() //--- so it reads the remote directory mftp.CurrentDirectory.BeginGetFile(ServFile);
and perhaps it works in combination of both :
mftp.CurrentDirectory.FindFile(ServFile); mftp.CurrentDirectory.BeginGetFile(ServFile)
good luck  pascal
|
| Sign In·View Thread·PermaLink | 2.00/5 (1 vote) |
|
|
|
 |
|
|
ReadAppendChar will block in s.read (::response.cs) if there isn't anything incomming from remote server, so your thread hangs and isn't interruptible (thread.abort() has no effect - no idea, why). so i wrote this fix to have a timeout (set the time as needed! by yourself).
<code> private char ReadAppendChar(Stream s, ref System.Text.StringBuilder Text) { try { byte[] Buffer = new byte[1]; IAsyncResult Result = s.BeginRead(Buffer, 0, Buffer.Length, null, null); Result.AsyncWaitHandle.WaitOne(500, false);
if (s.EndRead(Result) > 0) { char Sign = (char)Buffer[0]; Text.Append(Sign); return Sign; } else { throw new Exception("timeout"); } } catch (Exception ex) { throw ex; } } </code>
greetings! pascal
/* no comment */
|
| Sign In·View Thread·PermaLink | 5.00/5 (1 vote) |
|
|
|
 |
|
|
In fact this problem occurs fairly frequently. It is a race condition that happens when the server outputs two responses directly after each other. This happens especially often with the list command, where the server outputs the list, and then the "OK" message.
Because of the way the stream reader works, it reads ahead in the stream. When you call the constructor for the FTPResponse, you create a new stream reader, and thus discards the old one. This is a serious problem since the previous stream reader has already buffered the data. The new stream reader will block forever, since there is no more data.
The solution is to use just one stream reader, and pass that to the FTPResponse constructor.
Another bug in the FTPResponse reader, is that it cannot parse multiline responses:
220 OK - Features: MDTM XFR 220-OK
It will try to parse the number in each line, and throw an exception when parsing line 2. It is a fairly small fix. Other than that, actually a really nice component.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Could any one help us how to read the xml file and rename the file present in the ftp server through c# programming langaugae.
|
| Sign In·View Thread·PermaLink | 1.00/5 (1 vote) |
|
|
|
 |