• Welcome to Valhalla Legends Archive.
 

File Transfer Over Winsock

Started by Clan CDH, November 04, 2006, 11:31 PM

Previous topic - Next topic

Clan CDH

How would I go about doing this?

Networks

Wait till you receive all the data and then output in in a file and save it with the proper extension?

Clan CDH


topaz

Send the file data over winsock?
RLY...?

Yegg

Quote from: topaz on November 05, 2006, 07:10 PM
Send the file data over winsock?

Read data (in the form of binary) from the file you would like to send over a winsock connection. You could read up to 1024 bytes from the while at a time and send that over. Every time you read from the file, check to make sure you havn't hit the end of the file yet (I'm not sure if VB6 would handle this by default or not). The connection on the other end which is to receive the file must know when the data is going to be sent, and it has to know which data belongs to the file it is going to receive. The side of the connection sending the file should first send a "notice" over to the connection receiving the file, letting it know that a file is about to be sent (you may also want to include in this notice some of the information about the file that the connection receiving might need to know). For every n amount of bytes received on the connection receiving the file, the bytes should be written (in the form of binary) to a file (the notice may also include the name of the file if file name matters).

This should make things pretty clear.

NetNX

you need to write the sender and reciever seperate and put them together at the end (that way you have 2 applications (2 clients) to test your file transfer)

To elaborate on Yegg's methods i suggest using a header (containing the filename to be transfered and size)