Receive file sended with TransmitFile()
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: Receive file sended with TransmitFile()

  1. #1
    Join Date
    Feb 2011
    Posts
    8

    Receive file sended with TransmitFile()

    Hi Everybody,

    The MSDN shows how to use the API TransmitFile() to send a file over a conneciton-oriented socket.. but it does not show you how to receive it!

    Is it done with the recv function or is it done in any other way?

    I want this becouse I'm making a chat program. By now it is a frame with a menubar with two (useful, there are more non-useful) entries. Both options creates a child window, but server option sets up a server, and client options conects to a server.

    I'm a bit strucked in the function of sending and receiving files. So any help is wellcome

  2. #2
    Join Date
    May 2006
    Location
    Indonesia & Japan
    Posts
    399

    Re: Receive file sended with TransmitFile()

    AFAIK, you can use receive() function to receive file data. The TransmitFile() is just an optimized sending function in sender side.
    henky
    ----------------------------------
    henky@nok.co.id is not my email address anymore...
    Jangan Pernah Menyerah

  3. #3
    Join Date
    Feb 2011
    Posts
    8

    Re: Receive file sended with TransmitFile()

    Quote Originally Posted by henky@nok.co.id View Post
    AFAIK, you can use receive() function to receive file data. The TransmitFile() is just an optimized sending function in sender side.
    Ok, but another question, Is there a function to know when it's a file and not text? and How to rebuild the file on the receiver side?

  4. #4
    Join Date
    May 2006
    Location
    Indonesia & Japan
    Posts
    399

    Re: Receive file sended with TransmitFile()

    Quote Originally Posted by pedro00pedro View Post
    Ok, but another question, Is there a function to know when it's a file and not text? and How to rebuild the file on the receiver side?
    You have to build a mechanism (protocol) so the receiver knows received data has to be saved into file.

    To rebuild the file, just save all receive data into file, but as i mention above, you have to build a mechanism how to transfer the file. The good example may be FTP protocol.
    henky
    ----------------------------------
    henky@nok.co.id is not my email address anymore...
    Jangan Pernah Menyerah

  5. #5
    Join Date
    May 2006
    Location
    Indonesia & Japan
    Posts
    399

    Re: Receive file sended with TransmitFile()

    I forgot to tell you. There is no function to know received data is a file data or just a text.
    I suggest you to see RFC959 (File Transfer Protocol) as an example.

    http://datatracker.ietf.org/doc/rfc959/
    henky
    ----------------------------------
    henky@nok.co.id is not my email address anymore...
    Jangan Pernah Menyerah

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center