Link to home
Start Free TrialLog in
Avatar of ofer1
ofer1

asked on

unix ftp in c.

I need to write in c or c++ a ftp for unix, that will get files from NT machine.
How I can write it in c or c++, I could not find a library that support the getFile or putFile ....
Avatar of bertvermeerbergen
bertvermeerbergen

I suppose you only want to write an ftp client, and that you have an ftp server running on the NT.  Writing a client is not very hard, but as you certainly know, there is one in every standard unix distribution.  So make sure you have a good reason to start reinventing the wheel.
This said, you have a few options:
1. Get RFC959 and implement the client functionality.  If you know about socket programming, it really is not that hard.
2. Since you have a Unix box, use the standard ftp server deamon to do all the hard work and just write your client to handle the control connection, initiating transfer between the NT and Unix ftp server (so called proxy transfers).  See Q.10052364 for more info on how this works.
3. Get the source code for the ftp client under Linux.  This will give you a very good starting point (Just don't copy it and put your name under it).
4. Wait for someone to supply you with a reference to a library that implements getFile/putFile.  I suppose there must be one somewhere, but I do not have any info on this.  But if you are looking for additional control over the ftp session (the only good reason to write your own client, in my opinion), I do not think you really want do you such a library.
Check out Q.10095891.  Client FTP functionality is currently being discussed under that topic.
ASKER CERTIFIED SOLUTION
Avatar of rbr
rbr

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You can, but how do you pass the commands you want executed ?
And just try to capture errors or even making sure that the files are down- or uploaded.  Every 'normal' ftp client I have seen is well designed to be used interactively.  Programmatic control was never an option during the design, I suppose.

Avatar of ofer1

ASKER

rbr believe me or not, if i had new how to call this ftp client from c, I wasn't put this question here
ofer1, did you get some work done on your ftp client implementation ?