LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

InetFTPGetDirList hangs ....

I feel a little stupid once again.... ;-(

 

I ran the following simple code to read some files from a remote ftp server....

 

// Login to FTP site and set passive mode
    ftp_handle = InetFTPLogin (server, username, password);
    if (ftp_handle < 0)
    {
        InsertListItem(ChildPanel,INFOPANEL_INFOBOX,-1,"Server nicht gefunden",0);    
        return ;
    }

    InsertListItem(ChildPanel,INFOPANEL_INFOBOX,-1,"Login erfolgreich",0);    
   
    InetFTPSetPassiveMode (ftp_handle, 1);
   
    // change dir
   
    DisableBreakOnLibraryErrors ();      
    error = InetFTPChangeDir (ftp_handle, "stpara");
    EnableBreakOnLibraryErrors ();   
    if (error)
    {
        InsertListItem(ChildPanel,INFOPANEL_INFOBOX,-1,"Kann Verzeichnis nicht wechseln...",0);  
        return ;           
    }   

    // get files

    if ((error = InetFTPGetDirList (ftp_handle, &files, &num)) < 0)
    {
        // see comment after Error: label below
        if (error <0)
        {  
            ;
        }
     }

 

 

... looks like it works until it wants to read the directory... gets stuck für 5 Minutes (!) and reports Error -11 and a hint to try "passive mode" .

I´m scratching my head ...

 

HELP - it´s not a really important project, but i´d like to impress my boss with online update compatibility.

 

all the best

 

dos

0 Kudos
Message 1 of 5
(3,502 Views)
Which FTP server are you trying to browse, and what is the current working directory on the server when you get this error? Have you tried running the internet/ftpclnt sample program to browse this FTP server? Some FTP servers return an error if a directory is empty - the sample program adjusts for this. You may wish to do the same thing in your program.
0 Kudos
Message 2 of 5
(3,489 Views)

Thank you very much for your reply.

 

I´m using our company ftp server. I tried a connect in a terminal window, the chdir command works both in terminal and in CVI. The directory is not empty and the local working directory is double checked and ok.

 

I get a "-13" error which says - unbeliebable - "ftp error" and this is the really annoying part: i´ve no chance finding out what the realy problem is. Is there any chance doing a "lower level access"? I´m sure i made a mistake but how to find out?

 

The last alternative that could keep me going would be running system commands....

 

best regards

 

Dominik

0 Kudos
Message 3 of 5
(3,476 Views)
... I´d like to add i ran wireshark und saw that the ftp commands actually works, the directory list is sent from the remote server to my end but the task on my side simply stops...
0 Kudos
Message 4 of 5
(3,467 Views)

Hmm... I am not sure I understand. You are saying the chdir command works both in terminal and CVI. By this, do you mean everything is fine in terminal and CVI? Also, by CVI do you mean some sample program or your program? Which function returns -13? -13 refere to "kInetFTPFileError" and this is returned if there was an FTP protocol error relating to some file or directory. Have you tried browsing to this directory using the Windows console FTP command and Internet Explorer? You may want to try this.

 

Does this error only happen with one specific directory on the server or with all directories? See if there is anything strange about the directory name, or the names of the contents of the directory. Try renaming this server directory and changing the contents of the directory. Also, what FTP server are you running on the server machine? You should check the documentation of the server to see if there are any special issues with certain directory and file names, etc. You may also want to try running a different FTP server.

0 Kudos
Message 5 of 5
(3,462 Views)