LabWindows/CVI

annulla
Visualizzazione dei risultati per 
Cerca invece 
Intendevi dire: 

InetFTPGetDir function does not retrieve the whole DIR string

Hello,
I am trying to get info on the current dir of a remote computer with error= InetFTPGetDir(ftp_handle, dir, MAX_FTP_PATHNAME_SIZE).  This function only returned a partial dir string.  The whole string should be: Current directory is "/EngDIr/".  The function returned: urrent directory is
Any suggestion is well appreciated.
Best Regards
Ton Ng
 
0 Kudos
Messaggio 1 di 6
3.814Visualizzazioni

What version of CVI are you using?

What FTP server are you using?

How are you declaring the dir variable?

There's an earlier message about problems with InetFTPGetDir that didn't seem to get resolved.  http://forums.ni.com/ni/board/message?board.id=180&message.id=24006&query.id=223193#M24006 

Messaggio 2 di 6
3.799Visualizzazioni
Hi TonNg,
 
Also, what is the error code being returned?  Please try running the example program ftpcInt and confirm that this gives the same result.  
 
 
Cheers,

David Goldberg
National Instruments
Software R&D
0 Kudos
Messaggio 3 di 6
3.776Visualizzazioni

Hello Cheers,

I am using CVI 8.0.1 example ftpclnt in the directory CVI80\Samples\Internet\ftpclnt.  The FTP server is VxWorks

The function InetFTPGetDir returned 0 (no error), but I got back an incomplete dir string.  The traffic monitor program Ethereal does indicate that the server sent a complete string.

CVI string return was truncated as urrent directory is  instead of Current directory is "/RAMDEV0/.  Please see attached capture file.

Best Regards,

Ton Ng

0 Kudos
Messaggio 4 di 6
3.765Visualizzazioni

Hypothesis: InetFTPGetDir() works by trying to parse the string returned by an FTP 'pwd' command in a farly simple way.

With a typical GNU/Linux FTP server, the string returned is like this:

"/" is current directory.

and you can see that if you remove the first character and copy everything up to the next double quote, you get the directory /.

However, applying the same algorithm to the string the the VxWorks FTP server returns:

Current directory is "/RAMDEV0/

would get you exactly what you are seeing.

Which would suggest that InetFTPGetDir will only work properly with FTP servers that act like the GNU/Linux one. Which isn't ever so useful for the other servers.

--
Martin
Certified CVI Developer
0 Kudos
Messaggio 5 di 6
3.755Visualizzazioni

The format returned by the VxWorks server does not obey the FTP RFC 959. Check out http://www.faqs.org/rfcs/rfc959.html. The response to PWD is supposed to be in the same format as the response to MKD, which should be of the form:

257<space>"<directory-name>"<space><commentary>

0 Kudos
Messaggio 6 di 6
3.734Visualizzazioni