|
-
Mar 14th, 2000, 11:00 PM
#1
Thread Starter
New Member
Hi,
I'm attempting to use the winsock control to access an FTP site and retrieve various files (primarily .zip and .exe)
I've setup two winsock controls :-
The first one connects to the FTP server, sends USER and PASS (anonymous), and then completes the PORT command.
The second listens on the localport sent via the PORT command on the first winsock control.
After this the first winsock control requests the file i require.
I get 'Opening ASCII mode data connection' response through the first control and even a completed '226' control code.
Here's the problem - nothing is sent to the second winsock control. If i change the localport to something other than the one specified by the PORT command before requesting file, i get an error from the FTP server - so i presume(?) there must be communication going on between the ports, yet the standard - winsock2.GetData StrData, vbString - in the Data_Arrival section yeilds nothing!?!
If anyone has any ideas on what i might be doing wrong i'd appreciate the helps.
Oh yeh, i'm using TCP protocol
Thanks,
Matt
-
Mar 15th, 2000, 12:56 PM
#2
Lively Member
Your first TCP/IP port is used for sending commands
stuff like ...
USER xxxx
PASS xxxx
PORT xxx,xxx,xxx,xxx,xxx,xxx
Those valuse indicate incoming IP address and listening port. So you must set another winsock to listen on the last port for the specified PORT command. If unsure search for "FTP RFC" in like http://www.yahoo.com
21 = Port used for sending commands
22 = DATA port, only file transfers use this port.
See the RFC if you're a little lost. Cheers
Regards,
 Paul Rivoli 
---------------------
[email protected]
http://members.dingoblue.net.au/~privoli
-
Mar 15th, 2000, 05:30 PM
#3
Try vbBinary instead of vbString and put the retrieved data in a byte array
-
Mar 19th, 2000, 07:41 PM
#4
New Member
-
Mar 19th, 2000, 08:47 PM
#5
New Member
-
Mar 19th, 2000, 11:12 PM
#6
Thread Starter
New Member
Thanks for the help everyone.
Oleg - I found your webpage a couple of days back. Extremely helpful; Best information i've found on the net about the winsock control. i've already referred a few other people to it.
I eventually found the problem - i wasn't closing the second winsock control after receiving an inbound connection (it's always the little things.) Anyhow, all's working great now.
Thanks again,
Legion
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|