CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8

Thread: FTP Issues

  1. #1
    Join Date
    May 2008
    Posts
    44

    FTP Issues

    Hi friends, I have learned enough to send and receive data between two computers via TCP protocol. I would like now to use this knowledge to move a file between them, however I still don t know very much about the structure of a file (of any extension: txt, doc, exe, pdf, )

    Could you please tell me how can I split a file in its more elemental parts to send it as a String of characters?

    Thanks in advance

  2. #2
    Join Date
    Sep 2004
    Location
    Holland (land of the dope)
    Posts
    4,123

    Re: FTP Issues

    however I still don t know very much about the structure of a file (of any extension: txt, doc, exe, pdf, )
    You don't need to know what kind of a file it is. All files are just binary data, so if you know how to send and receive data, you can also send a file.

    Could you please tell me how can I split a file in its more elemental parts to send it as a String of characters?
    You can't send or receive binary data with a CString, because a CString is text.

  3. #3
    Join Date
    May 2008
    Posts
    44

    Re: FTP Issues

    So what is the function I have to use to open or display all the binary content of a file?

    Regards

  4. #4
    Join Date
    Sep 2004
    Location
    Holland (land of the dope)
    Posts
    4,123

    Re: FTP Issues

    You can use a CFile object to read a block of data and use a CSocket to send the data to the other side. Repeat this process until the complete file is send.

    Here is a example on how to do that.

  5. #5
    Join Date
    May 2008
    Posts
    44

    Re: FTP Issues

    Thanks a lot. I´m going to look at it right now..

  6. #6
    Join Date
    Nov 2002
    Location
    California
    Posts
    4,556

    Re: FTP Issues

    Quote Originally Posted by Skizmo View Post
    Here is a example on how to do that.
    The code at that link doesn't work and should not be used (for proof, read all the comments that say "doesn't work" or "large files are corrupted" or "can't open transferred file").

    For a sample of code that works, together with an explanation of why the linked-to code does not, see "Network Transfer Of Files Using MFC's CSocket Class" at http://www.codeproject.com/KB/IP/Soc...eTransfer.aspx

  7. #7
    Join Date
    Sep 2004
    Location
    Holland (land of the dope)
    Posts
    4,123

    Exclamation Re: FTP Issues

    The code at that link doesn't work and should not be used (for proof, read all the comments that say "doesn't work" or "large files are corrupted" or "can't open transferred file").
    Oops ... Googled for an example, didn't really check the comments or anything. Thanx for correcting me.

  8. #8
    Join Date
    May 2008
    Posts
    44

    Re: FTP Issues

    Thanks a lot guys Iḿ now in the right way.

Tags for this Thread

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

Featured