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 :)
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.
Re: Receive file sended with TransmitFile()
Quote:
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?
Re: Receive file sended with TransmitFile()
Quote:
Originally Posted by
pedro00pedro
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.
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/