Results 1 to 6 of 6

Thread: FTP and winsock

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2000
    Posts
    2

    Post

    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

  2. #2
    Lively Member
    Join Date
    Nov 1999
    Location
    Melbourne, Victoria, Australia
    Posts
    126
    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

  3. #3
    Guest
    Try vbBinary instead of vbString and put the retrieved data in a byte array

  4. #4
    Take a look at my FTP Client sample application at http://www.vbip.com/winsock/winsock_ftp_client_01.asp

  5. #5
    Take a look at my FTP Client sample application at http://www.vbip.com/winsock/winsock_ftp_client_01.asp

  6. #6

    Thread Starter
    New Member
    Join Date
    Mar 2000
    Posts
    2
    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
  •  



Click Here to Expand Forum to Full Width