Click here to Skip to main content
Click here to Skip to main content

LightFTPClient: a basic FTP client

By , 9 May 2004
 

Introduction

This is a simple FTP client written in C#.

Usage

LightFTPClient is a basic FTP client. To implement FTP communication, I adapted the FTP client library of Jaimon Mathew.

LightFTPClient maintains data (username, password, port) of your connections in a list, so you can select one directly from the list. These data will be persisted into a file named lightftpclient.bin. This file will be created in the same directory where the executable is located. Data is saved when the program is closed.

Sample screenshot

System and error messages are shown in the middle area. At the bottom, on the left, there is the local path and its contents, on the right there is the remote path and its contents.

The following function is invoked to populate list referring local path.

protected void PopulateLocalFileList()
{
    //Populate listview with files
    string[] lvData =  new string[4];
    string sPath = txtLocalPath.Text;

    InitListView(lvLocalFiles);

    if (sPath.Length > 3)
        addParentDirectory(lvLocalFiles);
    else
    {

    }
    try
    {
        string[] stringDir = Directory.GetDirectories(sPath);
        string[] stringFiles = Directory.GetFiles(sPath);

        string stringFileName = "";
        DateTime dtCreateDate, dtModifyDate;
        Int64 lFileSize = 0;

        foreach (string stringFile in stringDir)
        {
            stringFileName = stringFile;
            FileInfo objFileSize = new FileInfo(stringFileName);
            lFileSize = 0;
            dtCreateDate = objFileSize.CreationTime;
                        dtModifyDate = objFileSize.LastWriteTime; 

            //create listview data
            lvData[0] = "";
            lvData[1] = GetPathName(stringFileName);
            lvData[2] = formatSize(lFileSize);
            lvData[3] = formatDate(dtModifyDate);

            //Create actual list item
            ListViewItem lvItem = new ListViewItem(lvData,0); // 0 = directory
            lvLocalFiles.Items.Add(lvItem);

        }

        foreach (string stringFile in stringFiles)
        {
            stringFileName = stringFile;
            FileInfo objFileSize = new FileInfo(stringFileName);
            lFileSize = objFileSize.Length;
            dtCreateDate = objFileSize.CreationTime; 
                        dtModifyDate = objFileSize.LastWriteTime; 

            //create listview data
            lvData[0] = "";
            lvData[1] = GetPathName(stringFileName);
            lvData[2] = formatSize(lFileSize);
            lvData[3] = formatDate(dtModifyDate);

            //Create actual list item
            ListViewItem lvItem = new ListViewItem(lvData,1); // 1 = file
            lvLocalFiles.Items.Add(lvItem);

        }

        // Loop through and size each column header
        // to fit the column header text.
        foreach (ColumnHeader ch in this.lvLocalFiles.Columns)
        {
            ch.Width = -2;
        }

    }
    catch (IOException)
    {
        MessageBox.Show("Error: Drive not ready or directory does not exist.");
    }
    catch (UnauthorizedAccessException)
    {
        MessageBox.Show("Error: Drive or directory access denided.");
    }
    catch (Exception ee)
    {
        MessageBox.Show("Error: " + ee);
    }
    lvLocalFiles.Invalidate();
    lvLocalFiles.Update();

}

Clicking on the header "Name", you can sort file list. To sort the file list, I make an implementation of the IComparer interface.

public class ListViewColumnSorter : IComparer
{
    /// <SUMMARY>
    /// Specifies the column to be sorted
    /// </SUMMARY>
    private int ColumnToSort;
    /// <SUMMARY>
    /// Specifies the order in which to sort (i.e. 'Ascending').
    /// </SUMMARY>
    private SortOrder OrderOfSort;
    /// <SUMMARY>
    /// Case insensitive comparer object
    /// </SUMMARY>
    private CaseInsensitiveComparer ObjectCompare;

    /// <SUMMARY>
    /// Class constructor.  Initializes various elements
    /// </SUMMARY>
    public ListViewColumnSorter()
    {
        // Initialize the column to '1'
        ColumnToSort = 1;

        // Initialize the sort order to 'Ascending'
        OrderOfSort = SortOrder.Ascending;

        // Initialize the CaseInsensitiveComparer object
        ObjectCompare = new CaseInsensitiveComparer();
    }

    /// <SUMMARY>
    /// This method is inherited from the IComparer interface.  
    /// It compares the two objects passed using
    /// a case insensitive comparison.
    /// 
    /// Comparison rules: 
    /// - directories are listed before (ascending)
    ///           or after (descending) than files;
    /// - both directories both files are listed
    ///           in ascending or descending order.
    /// </SUMMARY>
    /// <PARAM name="x">First object to be compared</PARAM>
    /// <PARAM name="y">Second object to be compared</PARAM>
    /// <RETURNS>The result of the comparison. "0" if equal,
    /// negative if 'x' is less than 'y' and positive
    /// if 'x' is greater than 'y'</RETURNS>
    public int Compare(object x, object y)
    {
        int compareResult;
        ListViewItem listviewX, listviewY;

        // Cast the objects to be compared to ListViewItem objects
        listviewX = (ListViewItem)x;
        listviewY = (ListViewItem)y;

        if ( (listviewX.ImageIndex == listviewY.ImageIndex) 
          ||  ((listviewX.ImageIndex +listviewY.ImageIndex) == 2) )
        {
            // items are of the same type (2 directory or 2 files)
            // with a tirck (listviewX.ImageIndex +listviewY.ImageIndex)
            // one is a link, one is a dir
            // Compare the two items
            compareResult = 
              ObjectCompare.Compare(listviewX.SubItems[ColumnToSort].Text,
              listviewY.SubItems[ColumnToSort].Text);
        }
        else
        {
            // items are of different type
            // directory are listed before (ascending order) than files
            // or after (descending order) than files
            // Note: in my FTP client
            // ImageIndex = 0 means that item is a directory
            // ImageIndex = 1 means that item is a file
            // ImageIndex = 2 means that item is a link
            compareResult = 
              ((listviewX.ImageIndex < listviewY.ImageIndex)?-1:1);
        }

        // Calculate correct return value based on object comparison
        if (OrderOfSort == SortOrder.Ascending)
        {
            // Ascending sort is selected, return normal
            // result of compare operation
            return compareResult;
        }
        else if (OrderOfSort == SortOrder.Descending)
        {
            // Descending sort is selected,
            // return negative result of compare operation
            return (-compareResult);
        }
        else
        {
            // Return '0' to indicate they are equal
            return 0;
        }
    }
    
    /// <SUMMARY>
    /// Gets or sets the number of the column to which
    /// to apply the sorting operation (Defaults to '0').
    /// </SUMMARY>
    public int SortColumn
    {
        set
        {
            ColumnToSort = value;
        }
        get
        {
            return ColumnToSort;
        }
    }

    /// <SUMMARY>
    /// Gets or sets the order of sorting to apply
    /// (for example, 'Ascending' or 'Descending').
    /// </SUMMARY>
    public SortOrder Order
    {
        set
        {
            OrderOfSort = value;
        }
        get
        {
            return OrderOfSort;
        }
    }
}

And I assigned it to the ListView.

.....
// Create an instance of a ListView column sorter and assign it 
// to ListView control.
lvwColumnSorter = new ListViewColumnSorter();
this.lvFiles.ListViewItemSorter = lvwColumnSorter;

lvwLocalColumnSorter = new ListViewColumnSorter();
this.lvLocalFiles.ListViewItemSorter = lvwLocalColumnSorter;
.....

To navigate, use mouse or type path in the respective input box, then type "Enter".

Use drag & drop to download or upload a file, and the context menu to rename/delete it or to refresh content (it's also possible to use function key).

Sample screenshot

System Requirements

This application was developed using VS.NET/C# and Microsoft .NET Framework 1.1, and tested on Win 2000.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Massimo Beatini
Web Developer
Italy Italy
Member
No Biography provided

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
QuestionHow to change the property of directory?memberwen22920218 Oct '07 - 17:46 
Hello,
This programm looks great, but I have a problem.
I can't change the property of the directory that I sent to ftp server.
(The file that I send is read only)
Could you help me ?
Thank you very much!
 
wen

GeneralVery Nice!memberstevo346312 Sep '07 - 17:13 
This is a very nice FTP client!
 
Very Impressive to say the least, your effort shows.
 
Big Grin | :-D
QuestionDoes this support proxy?memberSunil Kumar Sharma "Sun"27 Aug '06 - 21:28 
Does this support proxy?
 
Sunil
GeneralPASV and PORTmemberdongshan23 Aug '06 - 22:04 
hi,Massimo,LigthFTPClient use as Passive FTP,it works good,but now,i need to use PORT mode,and do you know how to use this command?
 
this is my code
====================================
Dim strT As String
strT = "192,168,42,27,19,70"
 
'192.168.42.27:this ip is local ip
'19,70:that is randomly imported by me
 
sendCommand("PORT " & strT)
 
Dim ipAddress As String = Me.strServer
Dim port As Int32 = 19 * 256 + 70
 
Dim socket As Socket = Nothing
Dim ep As IPEndPoint = Nothing
 
socket = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
ep = New IPEndPoint(Dns.Resolve(ipAddress).AddressList(0), port)
socket.Connect(ep)
 
====================================
but this have a problem,when it execute to socket.Connect(ep),
there is no replay from server.

AnswerRe: PASV and PORT [modified]memberMassimo Beatini1 Sep '06 - 4:53 
Hi,
LigthFTPClient was not built to use "active mode" (PORT mode), to use it I have to redesign the application logic (probably in the future I'll do it).
 
The following text explain how "active mode" works:

A client opens a connection to the FTP control port (port 21) of an FTP server. So that the server will be later able to send data back to the client machine, a second (data) connection must be opened between the server and the client.
 
To make this second connection, the client sends a PORT command to the server machine. This command includes parameters that tell the server which IP address to connect to and which port to open at that address - in most cases this is intended to be a high numbered port on the client machine.
 
The server then opens that connection, with the source of the connection being port 20 on the server and the destination being the port identified in the PORT command parameters.

 
About your code
dongshan wrote:
socket = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
ep = New IPEndPoint(Dns.Resolve(ipAddress).AddressList(0), port)
socket.Connect(ep)

 
To receive data from FTP server you must create a socket but you haven't to connect to it, the ftp server has to do.
You have to listen on it, you should change the code in this way (C# code, I hope it wasn't a problem)
....
socket = new Socket(AddressFamily.InterNetwork,SocketType.Stream,ProtocolType.Tcp);
ep = new IPEndPoint(Dns.Resolve(ipAddress).AddressList[0], port);
// bind to the local endpoint
socket.Bind(ep);
socket.Listen(1000);
 
socket.BeginAccept(new AsyncCallback(this.AcceptCallback), socket);
...
 
/// 
/// Decription: Call back method to accept new connections.
/// 
/// <param name="ar">Status of an asynchronous operation.</param>
private void AcceptCallback(IAsyncResult ar)
{
        // Get the socket that handles the client request.
	Socket listener = (Socket) ar.AsyncState;
	Socket handler = listener.EndAccept(ar);
 
       // use handler to receive ftp server's data

        Byte[] receiveBuffer = new Byte[1024];
	string l_strOutput = "",l_strTemp = "";
 
	for ( ; ( l_iRetval = handler.Receive(receiveBuffer)) > 0 ;  ) 
	{
   	        l_strTemp = Encoding.ASCII.GetString(receiveBuffer,0,l_iRetval);
		l_strOutput += l_strTemp;
		if ( handler.Available == 0 )
		{
			break;
		}
	}
 

	handler.Close();
 
}
I hope this can help you.Smile | :)
 
Bye
Massimo
 

 

-- modified at 11:00 Friday 1st September, 2006
GeneralRe: PASV and PORTmemberdongshan9 Oct '06 - 21:03 
thanks Massimo Smile | :)
GeneralRe: PASV and PORTmembermaximus.dec.meridius2 Sep '09 - 9:47 
hello Massimo,
 
In order to use your great code with Active mode, would that require the re-design of the whole application? or just the createDataSocket() function?
 
The posts here are from 2006. Have you changed this appplication lately?
 
Thank you!
Maximus
GeneralTimeouts in FtpClient.readLine()memberSimon Steed (MadSi)4 Apr '06 - 3:51 
Hi,
 
I'm getting timeouts in the application, specifically around the following code in readLine() method:
 
for ( ; ( l_iRetval = clientSocket.Receive(receiveBuffer)) > 0 ; )
 
The file is being downloaded successfully but the client just becomes unresponsive - has anyone else had this problem?
 
Cheers
 
Si

AnswerRe: Timeouts in FtpClient.readLine()memberMassimo Beatini4 Apr '06 - 4:39 
Hi,
 
just because you're speaking about of a downloaded file I think that the problem could be elsewhere.
Probably in downloaded function.
 
Please have a look to the following link
 
http://www.codeproject.com/csharp/LightFTPClient.asp?msg=1300511#xx1300511xx
 
Bye
Massimo
GeneralRe: Timeouts in FtpClient.readLine()memberSimon Steed (MadSi)4 Apr '06 - 22:46 
Hi,
 
I managed to sort out the problem, it was indeed in the Download method but was not covered by your previous answer.
 
The original code:
 
if ( cSocket.Connected ) cSocket.Close();
 

this.readResponse();
 
if( this.resultCode != 226 && this.resultCode != 250 )
FireException(this.result.Substring(4));
}

 
And the fixed code:
 
if ( cSocket.Connected ) cSocket.Close();
 
if(cSocket.Connected == true)
this.readResponse();
 
if( this.resultCode != 226 && this.resultCode != 250 )
FireException(this.result.Substring(4));
}

 
BAsically i'm checking to be sure the socket is still actually connected, if not then skip reading any more responses, otherwise carry on as normal. What appeared to be happening was the socket was being closed then you were reading more data from the socket hence the deadlock - this fix addresses the problem I experienced.
 
I'm surprised no one else has had the same problem though, really surprised!
 
Regards
 
Si Big Grin | :-D
AnswerRe: Timeouts in FtpClient.readLine()memberMassimo Beatini5 Apr '06 - 0:25 
Many thaks for your fixed code.
 
Bye
Massimo
Smile | :)
GeneralRe: Timeouts in FtpClient.readLine()memberregistrationisformexicans21 Dec '06 - 7:08 
That helped me too, thanks!
QuestionAdditions?memberrball15 Mar '06 - 13:06 
I have a few additions that I added to the existing code:
 
Ability to create/remove directories
Upload multiple files at a time
 
Should I just post it here? Or you want it?
 

AnswerRe: Additions?memberMassimo Beatini15 Mar '06 - 23:17 
Thanks for your addition,
please send me your code and I'll include it with a reference to you in comments.
Then as soon as possible I'll update my article.
 
However if you want to share immediatly your code post it in this forum too.
 
Thanks again
 
Massimo

GeneralRe: Additions?memberrball16 Mar '06 - 6:06 
Sure, here's the beef of what I've completed so far.
 
Enable multiple select on the lvLocalFiles. Then modify lvFiles_DragDrop to:

private void lvFiles_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
{
foreach(ListViewItem lvi in lvLocalFiles.SelectedItems)
{
if ((CurrentEffect == DragDropEffects.Copy) && (((ListView)sender).Name != startingFrom))
{
if(lvi.ImageIndex == INDEX_TAG_FILE)
UploadFile(sLocalPath+ (sLocalPath.EndsWith("\\")?"":"\\")+lvi.SubItems[1].Text, false);
else if (lvi.ImageIndex == INDEX_TAG_DIR)
UploadDirectory(sLocalPath+ (sLocalPath.EndsWith("\\")?"":"\\")+lvi.SubItems[1].Text, true);
}
}
GetFileList("");
}

 
Modify contextMenuRemote by adding a "Create Directory..." item. Call this method when a user clicks the item:
 

///
/// Create a new folder on the remote server.
///

///
private void CreateFolder()
{
frmCreateDirectory frm = new frmCreateDirectory();
string folder = string.Empty;
if((folder = frm.ShowModal()) != string.Empty)
{
try
{
ftpClient.MakeDir(folder);
}
catch (FtpClient.FtpException ex)
{
Warning("", ex.Message);
}
finally
{
this.GetFileList("");
}
}
}

 
Add new Form frmCreateDirectory:
 

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
 
namespace LightFTPClient
{
///
/// Summary description for frmCreateDirectory.
///

public class frmCreateDirectory : System.Windows.Forms.Form
{
private System.Windows.Forms.Button btnOk;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.TextBox txtDirectory;
///
/// Required designer variable.
///

private System.ComponentModel.Container components = null;
 
public frmCreateDirectory()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
 
//
// TODO: Add any constructor code after InitializeComponent call
//
}
 
public string ShowModal()
{
string retval = txtDirectory.Text;
txtDirectory.SelectAll();
if (this.ShowDialog() == DialogResult.OK)
{
retval = txtDirectory.Text;
}
return retval;
}
 
///
/// Clean up any resources being used.
///

protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
 
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///

private void InitializeComponent()
{
this.txtDirectory = new System.Windows.Forms.TextBox();
this.btnOk = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// txtDirectory
//
this.txtDirectory.Location = new System.Drawing.Point(8, 16);
this.txtDirectory.Name = "txtDirectory";
this.txtDirectory.Size = new System.Drawing.Size(176, 20);
this.txtDirectory.TabIndex = 0;
this.txtDirectory.Text = "";
//
// btnOk
//
this.btnOk.DialogResult = System.Windows.Forms.DialogResult.OK;
this.btnOk.Location = new System.Drawing.Point(8, 56);
this.btnOk.Name = "btnOk";
this.btnOk.TabIndex = 1;
this.btnOk.Text = "Ok";
//
// btnCancel
//
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Location = new System.Drawing.Point(104, 56);
this.btnCancel.Name = "btnCancel";
this.btnCancel.TabIndex = 2;
this.btnCancel.Text = "Cancel";
//
// frmCreateDirectory
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(192, 85);
this.ControlBox = false;
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOk);
this.Controls.Add(this.txtDirectory);
this.Name = "frmCreateDirectory";
this.Text = "Create New Directory";
this.ResumeLayout(false);
 
}
#endregion
}
}

 
Modify frmMain.menuItem3_Click:
 

private void menuItem3_Click(object sender, System.EventArgs e)
{
// delete
ListViewItem lvItem;
ListView lv = (ListView)(contextMenuRemote.SourceControl);
 
if (lv.SelectedIndices.Count > 0)
{
lvItem = lv.SelectedItems[0];
if (lvItem.ImageIndex == INDEX_TAG_FILE)
{
DeleteFile(lvItem.SubItems[1].Text);
GetFileList("");
}
else
if(lvItem.ImageIndex == INDEX_TAG_DIR)
{
ftpClient.RemoveDir(lvItem.SubItems[1].Text);
GetFileList("");
}

}
}

 
I've only tested a few times, but everything seems to be working. Hope this helps Wink | ;)
GeneralError return : invalid response for PASV commandmemberseb.4928 Feb '06 - 4:33 
Hello,
 
This programm looks great, but I have a problem, I can't connect my FTP server because I have this result :
 
invalid response for PASV command
 
Could you help me ?
Regards
AnswerRe: Error return : invalid response for PASV commandmemberMassimo Beatini28 Feb '06 - 20:55 
Hi,
only the error message is not enough to help you.
2 steps towards the solution:
 
1. try to connect to your ftp via command line using the same commands and note if it works
 
2. send me your ftp address so I can make a test
 
Bye
Massimo
GeneralRe: Error return : invalid response for PASV commandmemberseb.4928 Feb '06 - 23:01 
Thanks for your response.
 
1. try to connect to your ftp via command line using the same commands and note if it works
--> I don't understand how do this.
 
2. send me your ftp address so I can make a test
--> the server is ftp.numericable.fr but it is not an anonymous server. I can't give you my password.
 
For information it is not ths first time I test a ftp program and always I have this PASV error. I usually use FileZilla and it works fine but I need to add functionnality so your software interest me

AnswerRe: Error return : invalid response for PASV commandmemberMassimo Beatini28 Feb '06 - 23:34 
Ok,
open a DOS prompt window then write:
 
1. ftp ftp.numericable.fr ENTER then wait response
2. user "your username" ENTER then wait response
3. pass "your password" ENTER then wait response
4. SYST ENTER then wait response
5. PWD ENTER then wait response
6. PASV ENTER then wait response
7. LIST ENTER then wait response
 
Try this and verify if it works in PASSIVE MODE.
 
Let me know.
 
Bye
 
Massimo

GeneralRe: Error return : invalid response for PASV commandmemberseb.491 Mar '06 - 2:26 
I have lots of error :
 
ftp ftp.numericable.fr
Connecté à ftp.numericable.fr.
220 dummer.numericable.net FTP server ready
Utilisateur (ftp.numericable.fr:(none)) : ***********
331 Password required for ***********.
Mot de passe :
230 User sdelestre10 logged in.
ftp> SYST
Commande non valide.
ftp> PWD
257 "/" is current directory.
ftp> PASV
Commande non valide.
ftp> LIST
Commande non valide.
ftp>
AnswerRe: Error return : invalid response for PASV commandmemberMassimo Beatini1 Mar '06 - 2:49 
Hi,
try to use the following commands
 


ftp> SYST ====> use literal SYST ENTER. This is not necessary but it shows the S.O. of your ftp server.

ftp> PASV ====> use literal PASV ENTER


 
and see if your ftp server support passive mode.
 
Bye
Massimo

GeneralRe: Error return : invalid response for PASV commandmemberseb.491 Mar '06 - 3:19 
Exactly same message :
 
ftp ftp.numericable.fr
Connecté à ftp.numericable.fr.
220 dummer.numericable.net FTP server ready
Utilisateur (ftp.numericable.fr:(none)) : *******
331 Password required for ********.
Mot de passe :
230 User ******** logged in.
ftp> SYST ENTER
Commande non valide.
ftp> PWD ENTER
257 "/" is current directory.
ftp> PASV ENTER
Commande non valide.
ftp> LIST ENTER
Commande non valide.
ftp>
 
-- modified at 9:22 Wednesday 1st March, 2006
With FileZilla :
 
Etat : Connexion à ftp.numericable.fr ...
Etat : Connecté à ftp.numericable.fr. Attente du message d'accueil...
Réponse : 220 dummer.numericable.net FTP server ready
Commande : USER *******
Réponse : 331 Password required for *******.
Commande : PASS *******
Réponse : 230 User *******logged in.
Commande : FEAT
Réponse : 500 FEAT not understood.
Commande : SYST
Réponse : 215 UNIX Type: L8
Etat : Connecté
Etat : Récupération de la liste de répertoires...
Commande : PWD
Réponse : 257 "/" is current directory.
Commande : TYPE A
Réponse : 200 Type set to A.
Commande : PORT 192,168,1,143,17,47
Réponse : 200 PORT command successful.
Commande : LIST
Réponse : 150 Opening ASCII mode data connection for file list.
Réponse : 226-Transfer complete.
Réponse : 226 Quotas on: using 14.78 of 200.00 MB
Etat : Succès du listage du répertoire
Commande : TYPE A
Réponse : 200 Type set to A.
Commande : REST 0
Réponse : 350 Restarting at 0. Send STORE or RETRIEVE to initiate transfer.
Réponse : 421 No Transfer Timeout (60 seconds): closing control connection.
Erreur : Déconnecté du serveur
Etat : Attente de relance... (encore 5 tentatives)
Etat : Connexion à ftp.numericable.fr ...
Etat : Connecté à ftp.numericable.fr. Attente du message d'accueil...
Réponse : 220 dummer.numericable.net FTP server ready
Commande : USER *******
Réponse : 331 Password required for sdelestre10.
Commande : PASS *******
Réponse : 230 User *******logged in.
Commande : FEAT
Réponse : 500 FEAT not understood.
Commande : SYST
Réponse : 215 UNIX Type: L8
Etat : Connecté

AnswerRe: Error return : invalid response for PASV commandmemberMassimo Beatini1 Mar '06 - 3:25 
There was a misunderstand...
after the ftp server send its response to your password
type all the word in red (literal is a ftp keyword) the press ENTER:
 
literal SYST
 
wait the response
 
literal PASV
 
wait the response.
 
See the message of your ftp server to this last command.
 
Bye
Massimo

GeneralRe: Error return : invalid response for PASV commandmemberseb.491 Mar '06 - 3:37 
Sorry I have not understand "literal"
 
so the result is :
 
ftp ftp.numericable.fr
Connecté à ftp.numericable.fr.
220 dummer.numericable.net FTP server ready
Utilisateur (ftp.numericable.fr:(none)) : sdelestre10
331 Password required for sdelestre10.
Mot de passe :
230 User sdelestre10 logged in.
ftp> literal SYST
215 UNIX Type: L8
ftp> literal PWD
257 "/" is current directory.
ftp> literal PASV
500 The server returned invalid response for PASV command.
ftp> literal LIST
Connexion fermée par l'hôte distant.
ftp>
 
thanks for your big help
AnswerRe: Error return : invalid response for PASV commandmemberMassimo Beatini1 Mar '06 - 4:15 
It seems that your ftp server doesn't support "passive mode".
 
That's all.
 
Massimo Smile | :)

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web04 | 2.6.130516.1 | Last Updated 10 May 2004
Article Copyright 2004 by Massimo Beatini
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid