Important alert: (current site time 7/16/2013 3:55:58 AM EDT)
 

winzip icon

FTP Server using the Winsock control

Email
Submitted on: 12/14/1999
By: Matt* 
Level: Advanced
User Rating: By 9 Users
Compatibility: VB 5.0, VB 6.0
Views: 45757
(About the author)
 
     This is a simple FTP server I developed using the Winsock control. Its got a few bugs in it that need to be solved as well as some missing features. But I think you will find this useful. It is more complete than any other FTP servers posted here. Its got plenty of comments so I hope it is easy to follow. If you make any additions or improvments please let me know. Would be neet if we could make this sort of a collaborative effort towards a decent FTP server. Updated: *FIXED sending files to the client. (FINALLY!)
 
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
  3. Scan the source code with Minnow's Project Scanner

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


Other 2 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Advanced category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments
12/14/1999 7:51:26 PMMatt T.

Whee...
Lemme know how you guys like my lil app.
I will continue work on it and post it here for all to see.
If you have any suggestions/updates etc drop me a line or post here.
(If this comment was disrespectful, please report it.)

 
12/14/1999 8:55:59 PMLP-S

If ppl like this app you will make update??? then, start working on it, cuz i loved it. I've been lookin for stuff like this a long time, and i only found crappy ftp servers wich only has an winsock.accept requestid (kidding...)
Ok, i liked it, i wish it could have deletion of file features, im gonna see if i can do that...
(If this comment was disrespectful, please report it.)

 
12/14/1999 9:17:34 PMMatt T.

Thanks for your feed back.
As per your request, delete file has been added.
(If this comment was disrespectful, please report it.)

 
12/14/1999 9:18:29 PMBranden

Sweet, just plain sweetness
(If this comment was disrespectful, please report it.)

 
12/14/1999 9:51:41 PMjoe

On that file transfer problem maybe try
setting the block size down to 1024.
That is what most servers send in chunk.

(If this comment was disrespectful, please report it.)

 
12/14/1999 10:15:22 PMMatt T.

I've tried everything joe...
I got the 4K/packet from CuteFTP, when it sends a file to my server it sends it in chunks around 4k...So I did the same heh.
(If this comment was disrespectful, please report it.)

 
12/14/1999 11:45:30 PMLP-S

Matt, thanx a LOT for it... this is great... im speechless (im brazilian, so i dunno if the word "Speechless" is right ;))
(If this comment was disrespectful, please report it.)

 
12/15/1999 6:32:59 AMLP-S

I have a little question. I can make a little client to connect an ftp server, but how can i retrieve the directory listings on 2 listbox? Any idea? If you want, please contact me at 48673690
Thanx
(If this comment was disrespectful, please report it.)

 
12/15/1999 10:30:32 AMRogger Vasquez

I PART
I notice you have trouble sending a file
to the client, and you say you think is
that the speed of the client or the server may be inolved. Well recently a group of students from my network class developed a File Server ( not FTP RFC) and a File CLient.
(If this comment was disrespectful, please report it.)

 
12/15/1999 10:33:35 AMRogger Vasquez

We notice that in some cases the files did not arrived completley, in many ocassions when we issued a SENDATA, WINSOCK did not send it inmediately, apparently buffering it until it had another chunk of data. And that precisley slow the process. So instead of using the METHOD SENDATA, we use a Direct Call (the send command) to the API of Winsock32. The last parameter
of this command has a flag, that if you
set it to 0, it will not buffer the
data and will try it to send it inmediately... The module or interface
to the WSOCK32.dll you can find it in
this site in the complete application category the name is IRC CHAT CLIENT,
and the specific file is WINSOCK.BAS, it
may help, or maybe thats not the problem
you have.. and keep up the good work
its a really good APP you have developed.

(If this comment was disrespectful, please report it.)

 
12/15/1999 11:32:58 AMMatt T.

Rogger, thanks for the tip. I figured I would have to use the Winsock API to get it to work properly. Sometime I would like to totally redo the entire FTP server using the Winsock API. I looked at Winsock.bas and it was just too much to work with heh. Was able to develop this alot faster just using the Winsock control because of its simplicity.
(If this comment was disrespectful, please report it.)

 
12/15/1999 3:58:44 PMPython

Plane GOOD!
(If this comment was disrespectful, please report it.)

 
12/15/1999 9:41:15 PMMatt T.

Bad news...I tried doing the file transfer by using the Winsock API instead of the Winsock control...No luck, same problem. I dont get it :(
Anyone else having the same problem?
(If this comment was disrespectful, please report it.)

 
12/16/1999 1:17:00 PMMikhael

Matt,
You have done a VERY GOOD job. I will use you code becouse I cant find an ftp server that is any good.
THANKS.
If you start a collaborative group or something I would like to help.
(If this comment was disrespectful, please report it.)

 
12/16/1999 11:20:09 PMMatt T.

Woohoo! Finally fixed that bug with clients getting incomplete downloads.
Sorry of the lack of comments with the new code that fixes this, its not too complicated, actually less complicated than it was before. I added a dataSock_SendCompleted sub in frmMain and changed around the send file functions.
shew...
(If this comment was disrespectful, please report it.)

 
1/11/2000 8:45:40 PMCracker Jack

I'm using VB5 and I have a problem. At first It was Split and Replace. But I added both those functions. Now I get THIS error: Can't Assign To Array
It happens on
tmparray = Split(ftpArgs, ",") during the PORT part.
Please Help!
(If this comment was disrespectful, please report it.)

 
1/21/2000 12:45:21 PMKami

Dis is wery goot page
(If this comment was disrespectful, please report it.)

 
1/23/2000 1:35:53 PMRyan

I get about 50 errors trying to compile this..to many to explain..can someone please email me an edited version that completely works..thanx
(If this comment was disrespectful, please report it.)

 
1/23/2000 1:42:05 PMMatt T.

Ryan,
Are you using VB 5.0? There are a few problems with VB 5.0 because there are a few functions that I use that only come with VB 6.0 such as the Replace() function. If you search planet-source-code for a replace function you should be able to take one of those and put it into the program.

(If this comment was disrespectful, please report it.)

 
2/8/2000 10:45:18 AMAndy

any1 know of the site that has the program called VB Amp. Its a really god mp3 player in vb and i lost the site. Please mail me if you have it.
(If this comment was disrespectful, please report it.)

 
2/10/2000 6:18:45 PMSean

Can you make it so you can rename a file. Please e-mail me when this has been updated or e-mail the code that I would use to do this. Thanx

(If this comment was disrespectful, please report it.)

 
3/9/2000 1:14:42 AMRiaan

I would like to know if the reget function, similar to the Godzilla function that recontinues with a transmission should you loose the connection is in this FTP server. I would really appreciate it if you could let me know of any examples of VB code where somthing like this is done. I am with my back against the wall. Thanks guys, and gals.
(If this comment was disrespectful, please report it.)

 
1/12/2002 8:32:38 PMPaul Mather

You have done an AWESOME job on this FTP server Matt! Its an EXCELLENT START! 5 Globes!
(If this comment was disrespectful, please report it.)

 
2/15/2002 9:50:49 AMJoe

GREAT JOB !
(If this comment was disrespectful, please report it.)

 
9/13/2002 1:42:55 PMChad Gutowsky

Hay, very nice job. I'm sure this is on my end, but I can't dir's. also Downloading works, but not up loading. I am using Bullet Proof as the client. How easy would it be to add the ability to change dir letters? Is there any updates to this killer code?

Regards,
Chad Gtowsky
(If this comment was disrespectful, please report it.)

 
3/30/2003 7:24:59 PM

I can't conenct when I start the Server up, it just gets stuck at SYST, I will try looking into the problem
(If this comment was disrespectful, please report it.)

 
3/30/2003 7:37:56 PM

There is no SYST Case, I tried putting one in, but this didn't help any. It still froze after the Reply of SYST
(If this comment was disrespectful, please report it.)

 
3/30/2003 7:43:18 PM

ok, when using flash FXP, you may need to add this into the FTP_Control module...

Case "SYST" 'SYST REPLY
send_response socket, "215 UNIX Type: L8" & ftpArgs

after doing that Flash FXP worked fine and listed the dir's
(If this comment was disrespectful, please report it.)

 
1/18/2004 5:47:51 PMMathew Parker

How you ment to make accounts for people? I'm looking for one like apache Instant Servers :/

-Neo
(If this comment was disrespectful, please report it.)

 
7/8/2004 12:41:40 PM

It doesnt do the ls (MS-DOS default ftp client) command... but the dir command is fine
(If this comment was disrespectful, please report it.)

 
8/3/2004 11:57:12 PM

I am using WS_FTP LE as the client and it uses the PASV command, which causes problems with the FTP server. Other then that, the code is very good! Can you let me know what to do about the PASV response?
(If this comment was disrespectful, please report it.)

 
8/4/2004 10:01:31 AMcdesign

The WS_FTP LE also has a MTDM state or command that it goes into after a file download. Do you know how to resolve this? Thanks.
(If this comment was disrespectful, please report it.)

 
8/24/2004 3:27:28 AMwww.loveboard.tk

I am not able to connect to the FTP server with my cute ftp. plese help me that are the username and password I should use
(If this comment was disrespectful, please report it.)

 
11/7/2004 1:56:06 PMPolygon105

Brilliant, please change it to csocket!! It would be the best ever then, as it would have no dependancies!
(If this comment was disrespectful, please report it.)

 
12/14/2004 3:08:21 PM

Works great inside my network. However when I try to connect from outside it fails to connect. I have traced it to the prog being unable to connect with the received IP and port. I suspect the RDR rules in the router but they seem to be correct. Has anyone else worked through a router? Thanks
(If this comment was disrespectful, please report it.)

 
1/14/2005 10:10:55 AMcdesign

I am having problems with sending files to this FTP server. Sometimes the full file transfers and other times only a portion of it transfers. Does anyone know how to fix this problem?
(If this comment was disrespectful, please report it.)

 
3/15/2005 9:15:43 AMMex Young

hey how does this software works... can anyone help me!!
(If this comment was disrespectful, please report it.)

 
7/4/2005 11:29:07 PM

Doesnt work wiht smartftp and internet explorer, in scmart ftp it was first asking for SYST so i added Case "SYST" 'SYST
send_response socket, "215 UNIX Type: L8" & ftpArgs But now it asks server for some FEAT command (215 UNIX Type: L8
FEAT)
(If this comment was disrespectful, please report it.)

 
12/24/2008 11:31:31 AMGabe

to get past the feat command reply with a 500 , command not found.
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.