socket definition

This is a discussion on socket definition within the Windows Programming forums, part of the Platform Specific Boards category; I am having a problem with sending and receiving messages between an ftp client and an ftp server. I have ...

  1. #1
    Registered User
    Join Date
    Sep 2002
    Posts
    35

    socket definition

    I am having a problem with sending and receiving messages between an ftp client and an ftp server. I have the initial socket opened for communication. I can't seem to get my 'ls' command to work.


    Do I need to have a separate socket established to receive data -like the 'ls' command (not system messages)???

    I should be get the directory returned when I issue 'ls' to the ftp server, but I get '405 error' and I am not sure what this means.

    Thanks

  2. #2
    Registered User johnnie2's Avatar
    Join Date
    Aug 2001
    Posts
    186

    Re: socket definition

    Originally posted by DMaxJ
    Do I need to have a separate socket established to receive data -like the 'ls' command (not system messages)???
    Exactly. An FTP session consists of one continuous control connection and multiple data connections. When the client makes a request of the server that requires a data transfer (such as a directory listing or file download), connection parameters are embedded into the request, like transfer mode, port to which the server should connect, and so on. The FTP server then connects to the client at the specified address and port, and the transfer takes place. This and much, much more is covered in RFC 959, the file transfer protocol specification.
    "Optimal decisions, once made, do not need to be changed." - Robert Sedgewick, Algorithms in C

  3. #3
    Registered User
    Join Date
    Sep 2002
    Posts
    35

    client parameters

    So, I kinda understood what you said...

    Does this mean that I have to know the parameters of the client prior to sending the request to the server???

    Also, how can I can I access the parameters that are embedded with the request???

    Thanks

  4. #4
    Registered User johnnie2's Avatar
    Join Date
    Aug 2001
    Posts
    186
    Sorry about that, should have been a little clearer.

    You specify the transfer parameters. You indicate to the server to which local port you'd like it to connect with one message. You can tell the server that you'll be connecting to it to retrieve or store data, if you like, with another message. You can change the transfer mode from the default setting with another message, etc.
    "Optimal decisions, once made, do not need to be changed." - Robert Sedgewick, Algorithms in C

  5. #5
    Registered User
    Join Date
    Sep 2002
    Posts
    35

    ftp commands

    I looked at the ftp manual from the link that you posted. Thanks, but I am still a little unclear about the commands that I should issue to get the transfer started.

    From what I gather on page 7, I can issue

    'user-PI' to initiate the "control connection" from port U.

    Where is port U initialized??? And, am I on the right track???

    Thanks

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Errors including <windows.h>
    By jw232 in forum Windows Programming
    Replies: 4
    Last Post: 07-29-2008, 02:29 PM
  2. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 07:39 AM
  3. DLL compiling question
    By Noose in forum Windows Programming
    Replies: 2
    Last Post: 12-16-2004, 07:16 AM
  4. Warnings, warnings, warnings?
    By spentdome in forum C Programming
    Replies: 25
    Last Post: 05-27-2002, 07:49 PM
  5. gcc problem
    By bjdea1 in forum Linux Programming
    Replies: 13
    Last Post: 04-29-2002, 07:51 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21