07-10-2006 04:25 PM
07-10-2006 05:02 PM
That depends on which version of CVI you have and whether or not you have the Internet Library. It used to be a separate add-on to CVI back when I first used it but it is definitely included with the full development system since at least version 7.0, maybe earlier.
There are functions to do an automatic transfer in one function call and to do it at a lower level.
07-11-2006 12:27 AM
Even with older versions of the IDE you can always use Windows API functions to implement a FTP transfer. Look at InternetConnect and FTPOpen functions in the SDK.
Finally, I'm not sure but it seems to me that you can also use DataSocket technology too for such a transfer.
07-11-2006 10:14 AM
There are always all sorts of options if you don't have the Internet Library. One of my favorite things to do is to use small Perl scripts for things I know it can do well such as regular expression parsing, I simply call the script with system() and pass the parameters to it on the command line. Since there is a very easy to use FTP module for Perl and Perl is open-source and free, this could be a viable option instead of diving into the mess that is the SDK and dealing with low-level protocol details.
Remember, the first virtue of the programmer is laziness. Reuse code whenever possible, use the tools that do the job with the minimum of effort, and don't re-invent the wheel.
07-11-2006 11:29 AM
07-11-2006 11:43 AM
Actually, an IP address should work. When you give a URL, it eventually is resolved through DNS to an IP address.
The schema part of the URL denotes the protocol, which is FTP and that is what you are trying to use anyway.
Now where this can get a bit messed up is if the server is configured to use a nonstandard port for serving the FTP protocol. This would be the caes if the domain portion of the URL has a : (colon) followed by a number such as ftp://ftp.somedomain.com:12345/ That denotes that a nonstandard port of 12345 is in use to serve that protocol.
Using the domain name has the advantage of looking up the IP address for you and you don't have to worry about tracking IP addresses should the server address change. It has the disadvantage of requiring DNS and DNS can sometimes cause delays of several seconds in connecting if the load at the DNS name server is high.
Using the IP address will be quicker, though under normal circumstances only marginally so. It has the disadvantage of requiring you to track any IP address changes of the server.
07-11-2006 12:48 PM
07-11-2006 12:59 PM - edited 07-11-2006 12:59 PM
It is possible that the FTP server you are attempting to connect to is a non-standard server. It wouldn't happen to be running VxWorks would it?
A typical Unix-style login looks like this:
% ftp server.somedomain.com
Connected to server.somedomain.com.
220 (vsFTPd 2.0.3)
User (server.somedomain.com:(none)): martin
331 Please specify the password.
Password:
230 Login successful.
ftp>
I no longer have access to any VxWorks based servers but I think the FTP server in VxWorks uses prompts that the CVI FTP functions don't recognize. This is particularly true of the directory output that it returns. When you log in via a terminal window, what do the prompts look like?
Since VxWorks is such a common target environment, it would be nice if CVI's FTP library could handle its quirks. It would also be nice if the developers of VxWorks would fix their non-standard implementation so it worked with 3rd-party libraries that expect Unix-style FTP output and prompts.
Unfortunately, even if VxWorks is fixed, it doesn't help all those legacy systems out there.
I doubt that handles returned from the Telnet functions will work with the FTP functions, if they did, you could telnet into the FTP port and log in and then go do the rest of what you need to do with the FTP functions.
If they don't, you can still do it all via the telnet interface (I think) but then you would have to essentially write your own FTP client library. That would be a major pain for anything but trivial operations.
If I were faced with this situation, I would turn to the Perl solution I described above, it is what I know and I can make it it work quite easily.
Message Edited by MJF on 07-11-2006 11:16 AM
07-11-2006 02:45 PM
07-11-2006 03:04 PM
The Internet Library FTP functions take a username and password, that is not the issue. What is at issue is whether the FTP function is able to parse the responses it is getting from the server or not and whether it is able to respond with the proper information at the proper time to achieve a log in.
While the scheme outlined in the link Roberto posted may work in a browser, I am not so sure it will with the FTP functions in CVI. It certainly can't hurt to try it but I personally doubt it will work.