Results 1 to 7 of 7

Thread: Winsock File Transfer Help Needed

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2009
    Posts
    5

    Winsock File Transfer Help Needed

    Hello - I'm using the Mabry socket controls and I'm trying to transfer a file. I've written the client server programs and everything works but there seems to be one problem and I can't figure out what is wrong.

    When the file is transferred it is corrupted. I have a test program that tries to send a 75 megabyte zip file. All of this is tested in my LAN environment (even running both programs client/server apps on my on my own computer). I have compared the files and noticed that what is happening is this: If I send chunks of data of say 1024 bytes then it successfully sends around 140K of data then 1024 bytes of data after that is nothing but zeros then data is good again for a random amount of bytes then another 1024 bytes of data is nothing but zeros.

    I have checked the client side and it is not ever loading the socket buffer with anywhere near 1000 zeros anywhere in the file. But, it's like random places throughout the received file have zeros in them. I'm sending data and checking for errors and when I get an error I stop sending data and wait for the send event to fire so that the mabry socket is ready to accept more data. When the file transfer finishes the file size does match - it's just it has these zeroed out chunks of data of 1024 bytes (which is the size I'm sending in a loop).

    Please help.
    Thanks,

  2. #2
    New Member
    Join Date
    Dec 2009
    Posts
    4

    Re: Winsock File Transfer Help Needed

    Hi

    I had also troubles with sending large files but fixed it.
    The thing is that the chunks are not always 1024 K and that the last chunk is filled with 0000
    I do not know how you store the buffer on server. first into a array or directly in a file ?


    Sacha

  3. #3
    Hyperactive Member knxrb's Avatar
    Join Date
    Jul 2007
    Location
    United Kingdom
    Posts
    321

    Re: Winsock File Transfer Help Needed

    Maybe take how much has been read/sent against how much there is left to read/send, and then set the program to read/send only the amount of bytes that are left.

    knxrb
    Last edited by knxrb; Jan 5th, 2010 at 04:02 PM.
    Did I help you with your problem? If I did rate me by clicking here: Rate knxrb

  4. #4

    Thread Starter
    New Member
    Join Date
    Dec 2009
    Posts
    5

    Re: Winsock File Transfer Help Needed

    I'm beginning to wonder if the Winsock has bugs in it and that is what the problem is. My code looks sound and works as long as I don't try and pass too much information.

    Mike

  5. #5
    Lively Member agent_007's Avatar
    Join Date
    Jan 2010
    Posts
    93

    Re: Winsock File Transfer Help Needed

    Quote Originally Posted by mike1960 View Post
    Hello - I'm using the Mabry socket controls and I'm trying to transfer a file. I've written the client server programs and everything works but there seems to be one problem and I can't figure out what is wrong.

    When the file is transferred it is corrupted. I have a test program that tries to send a 75 megabyte zip file. All of this is tested in my LAN environment (even running both programs client/server apps on my on my own computer). I have compared the files and noticed that what is happening is this: If I send chunks of data of say 1024 bytes then it successfully sends around 140K of data then 1024 bytes of data after that is nothing but zeros then data is good again for a random amount of bytes then another 1024 bytes of data is nothing but zeros.

    I have checked the client side and it is not ever loading the socket buffer with anywhere near 1000 zeros anywhere in the file. But, it's like random places throughout the received file have zeros in them. I'm sending data and checking for errors and when I get an error I stop sending data and wait for the send event to fire so that the mabry socket is ready to accept more data. When the file transfer finishes the file size does match - it's just it has these zeroed out chunks of data of 1024 bytes (which is the size I'm sending in a loop).

    Please help.
    Thanks,
    can u attach the source code so i can help u

    Im Pro in C#,VB.NET,Batch,Socket Programming, SPY Software Programming, VB6, Win32Api, VBscript, Windows Registry, ASP.NET, PHP, Jquery, AJAX.

  6. #6
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: Winsock File Transfer Help Needed

    I doubt the underlying Winsock API is the problem. You'd have lots of other problems if this were true.

    I just tested an old file transfer program of mine written in VB6 using the Winsock control. It transferred a 240MB DivX video just fine. The file plays fine with no glitches all the way through to the end.

  7. #7

    Thread Starter
    New Member
    Join Date
    Dec 2009
    Posts
    5

    Re: Winsock File Transfer Help Needed

    The problem seems to have something to do with the VFP 6/sp3 language I'm using because it does not have the problem in VFP 9. Perhaps a different third party control out there might work better if anyone knows.

    Thanks,

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width