Library code snippets

Winsock File Transfer

A basic example on how to transfer files across the network using the WinSock Control

Comments

  1. 16 May 2007 at 05:47

    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

     

  2. 12 Sep 2003 at 06:39

    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

  3. 30 Apr 2003 at 15:54
    how can i make the recieved file be saved to a specific directory

    dir1.path or somthing like that rather than app.path

    cheers
  4. 19 Apr 2003 at 17:39

    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

  5. 26 Jul 2002 at 13:34
    But, when I try to loop the send routine to send a list of files, they are all combined as one file when received at the server. I can see why this is happening, I just can't figure out how to make it stop

    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
  6. 27 Jun 2002 at 11:33

    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.

  7. 27 Jun 2002 at 10:40

    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:


    Code:
    sArriving = ""

    Place this just after the "close" statement in the client.


    Should solve your second problem at least.

  8. 26 Jun 2002 at 10:30

    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

  9. 30 May 2002 at 23:16

    After i run the codes,the result is:
    The size of testpic.gif is 3.70KB.
    The size of test
    picnew.gif is 4.32KB,and it is corrupt.

    AND after deleted test
    picnew.gif and run again,The SIZE of testpic_new.gif is 8.64KB.
    BTW,i am running win2K+sp2 with VB6+sp5.

  10. 22 Apr 2002 at 18:48

    You can place a progress bar by simply checking the microsoft basic controls 6.0 and adding the control.

  11. 05 Apr 2002 at 08:09
    is a progress bar possible?

    chad
  12. 01 Jan 1999 at 00:00

    This thread is for discussions of Winsock File Transfer.

Leave a comment

Sign in or Join us (it's free).

James Crowley James first started this website when learning Visual Basic back in 1999 whilst studying his GCSEs. The site grew steadily over the years while being run as a hobby - to a regular monthly audience ...
AddThis

Related discussion

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...

We'd love to hear what you think! Submit ideas or give us feedback