Library code snippets
Winsock File Transfer
By James Crowley, published on 14 Jul 2001
A basic example on how to transfer files across the network using the WinSock Control
Related articles
Related discussion
-
Problem with migration to C# (CoCreateInstanceEx)
by LRollison (1 replies)
-
VB6 Problem Creating Shortcuts
by rb1177 (0 replies)
-
how can i open a file
by kyawswarhtun (0 replies)
-
how to save any one form what i want?
by blackguy (5 replies)
-
Build an MP3 Player
by soybees (4 replies)
Related podcasts
-
Christian Beauclair
14 mai 2008 (�mission #0074) ::.Christian Beauclair: Stratégies de migration VB6 vers .NET Nous discutons avec Christian Beauclair des stratégies de migration VB6 vers .NET. Entre autres, nous discutons comment utiliser le "VB 6 Code Advisor" et le "Interop Forms Toolkit" pour ajouter la puiss...
If you are sending a pdf it must be read from the file as binary data, otherwise i thing you loose some information when strings are being converted - im not 100% sure of the specifics, i was able to get around this issue by opening the file for binary access then using the get and put methods to read/write to and from files. If you use get to read to a string it seems to keep the data intact
Hi, I've tried this one with different file types, but pdf's and xls' wont work. Can someone tell me how to fix that ?
Thanks
JIP
dir1.path or somthing like that rather than app.path
cheers
This is a really old message that im replying too but oh well. Its for all yo out there that have the same Q.
To send multiple files simply put a "DoEvents()" statement before doing your "Winsock.SendData strData"
Ciao
The "FILEEND" string is found in between files, so the server thinks it's one big file. I need to make the client wait and/or start a new transfer in between files.
Any ideas?
Thanks,
Phil
the code works pretty fine, but when you try to send a second file, it always pops up the same image you sent the first time.
the problem is solved on the client´s form, you have to clear the string sArriving, right after you receive the file.
You seem to have two different problems (3.7k changing into 4.32 and Doubeling of the file sent when you have sent a file twice). I can't explain the first and I can't make it do the same, but I can help with the doubeling problem:
Place this just after the "close" statement in the client.
Should solve your second problem at least.
As I understand it, this program (server) is loading the file to send in 64K chunks (loaded as a string), adding them togeather in one large string and sending the whole file at once.
You could try loading each 64k chunk and sending them indevidually and then programming the client send to pece them togeather instead of the server. The number of chunks sent will give you the data sent (/64K) and the length of the file will of course be the total size.
I havent tested this yet but if you want me to create and test an example and send you a copy, email me:
p.couling@btinternet.com
After i run the codes,the result is:
The size of testpic.gif is 3.70KB.
The size of testpicnew.gif is 4.32KB,and it is corrupt.
AND after deleted testpicnew.gif and run again,The SIZE of testpic_new.gif is 8.64KB.
BTW,i am running win2K+sp2 with VB6+sp5.
You can place a progress bar by simply checking the microsoft basic controls 6.0 and adding the control.
chad
This thread is for discussions of Winsock File Transfer.