Valhalla Legends Forums Archive | Visual Basic Programming | File Transfer Over Winsock

AuthorMessageTime
Clan CDH
How would I go about doing this?
November 5, 2006, 5:31 AM
Networks
Wait till you receive all the data and then output in in a file and save it with the proper extension?
November 5, 2006, 5:36 AM
Clan CDH
how would i do that?
November 6, 2006, 12:57 AM
Topaz
Send the file data over winsock?
November 6, 2006, 1:10 AM
Yegg
[quote author=topaz link=topic=15970.msg160842#msg160842 date=1162775421]
Send the file data over winsock?
[/quote]

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.
November 6, 2006, 1:35 AM
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)

November 14, 2006, 12:14 PM

Search