Web Hosting Talk







View Full Version : Code for FTP server and client


sueAnne
05-08-2005, 11:22 AM
Hi,

Now, i am trying to develop new FTP server and FTP client application. I want to ask if anybody here knows about FTP application. i am still in the beginning and trying to do some research on the Internet.

i am still not sure what the programming language might be used to develop the application. i need suggestions on that thing.

At this first step, i will study about the FTP first. Then, something which i do not understand...then i will ask anybody here. i hope i can.

do anybody have some hints or tips on developing this application?

Thanks..

innova
05-08-2005, 09:00 PM
Might want to start by reading the RFC's on FTP communication.

You may also wish to look at the sourcecode of simple FTP clients to get an idea what they are doing. I suggest the linux ftp and lftp programs.

I am curious as to why you are bothering :)

sueAnne
05-08-2005, 11:47 PM
Thanks for your helps and hints. I'll try what you've suggest.

I am doing my final year degree project (sth like thesis). my project is to develop new FTP server and FTP client application - which apply the simple and advanced features.

i hope u might help in this.But, for now i'm still at the beginning.
I have to study FTP and sth relates to it.

Not much i can ask now. But thanks. That's a lot of thing you've gave to me. Don't worry, i'll study hard and never miss every second.

gogocode
05-09-2005, 05:32 AM
sth like thesis

A thesis is an essay advancing a *new* point of view (new idea) resulting from research, not just implementing a well defined protocol. If you are really doing a thesis then you should go talk to your advisors about it because I can't imagine how one would write a thesis "on ftp".

sueAnne
05-09-2005, 08:59 AM
yes, it is sth about thesis (a little bit on thesis). But, my college is a technical college. i have to develop and implement new 'thing' whether to be implemented in the industry or the college itself.

some of my friends implement new projects such as enhancement of network simulator. one of my friends develop new remote software to allow simplicity and automatic setting on video conferencing. Basically, our final year degree project is about developing and implementing new things.

is that ok??? Sorry, my english is not as it should be.

innova
05-09-2005, 11:15 AM
If you really want to be lazy you could just write a client and server in php/perl :)

ActivI
05-09-2005, 07:12 PM
Hello.

Well an ftp server client has quite some room for innovation if you think of it as a protocol to reach something not as the "only" feature of the application.

If you consider Microsoft Outlook 2003 would you say it’s a POP3 application or a piece of software that among it’s features has a POP3 protocol implementation?

Get the idea?

Best regards.

sueAnne
05-09-2005, 11:22 PM
yup, i see that Activ1. Thanks to innova.

i'm just considering the features in Mozzila. the features for Mozilla might be useful for me to develop an advanced FTP client.

Vult-r
05-10-2005, 08:37 AM
The RFC for FTP can be found here
http://www.networksorcery.com/enp/protocol/ftp.htm

sueAnne
05-10-2005, 11:25 AM
ok...thanks for the info, Vult-r.

I will study on that. For now, i am doing the analysis phase. Just stuck right here. that info can be used in my analysis phase.

Thanks.

nnormal
05-10-2005, 11:57 AM
In the past I've used c++ with the wininet library to do ftp transactions. It is a wrapper for the more complex winsock library which you can use if you need more control. Here is an example of using this library to get a directory listing and printing it to a console window. It is barebones with no error checking, hard coded user/pass combo etc. but gives you an idea of how you go about it:


#include <string>
#include <iostream>
#include <windows.h>
#include <wininet.h>

using namespace std;

int main() {
WIN32_FIND_DATA findData;
HANDLE hInet, hCon, hFile;

string application = "appName";
string address = "xxx.xx.xx.xx";
string path = "/";
string user = "userName";
string pass = "password";

// open an internet handle
hInet = InternetOpen(
application.c_str(),
INTERNET_OPEN_TYPE_DIRECT,
NULL,
NULL,
0
);

// connect using an internet handle
hCon = InternetConnect(
hInet,
address.c_str(),
21,
user.c_str(),
pass.c_str(),
INTERNET_SERVICE_FTP,
0,
0
);

// create a file handle using a connection
hFile = FtpFindFirstFile(
hCon,
path.c_str(),
&findData,
0,
0
);

// loop thorugh a directory and print the filenames
while (InternetFindNextFile(hFile, &findData)) {
cout << findData.cFileName << "\n";
}


// close the handles
InternetCloseHandle(hFile);
InternetCloseHandle(hCon);
InternetCloseHandle(hInet);


system("pause");
return 0;
}


edit: this is for a win32 box obviously

sueAnne
05-10-2005, 12:01 PM
Ok, thanks nnormal. i'll refer to that code.

Thanks a lot.

nnormal
05-10-2005, 12:23 PM
you can read more about the wininet library at:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wininet/wininet/about_wininet.asp

sueAnne
05-10-2005, 12:54 PM
Thanks once again nnormal.

I'll take that.

Thanks for your help.

sueAnne
08-12-2005, 01:14 PM
hello.
once again...i would like to ask something about FTP Server and client. How can i improve the speed of file transfer (upload and download) for an ftp server and client?

tamasrepus
08-12-2005, 02:32 PM
I think it was the developer of WS-FTP who said this: why does everyone who wants to learn [Windows] network programming write an FTP client first?

sueAnne
08-14-2005, 11:16 AM
is it means that i have to develop the client first before i getting into the server?

tamasrepus
08-14-2005, 04:41 PM
Since FTP is a well established protocol it doesn't really matter...

IMHO, I'd write the server first, testing with another FTP client to make sure all functionality is there and correct, then write the FTP client.