Results 1 to 5 of 5

Thread: [RESOLVED] File transfer problems

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2007
    Posts
    70

    Resolved [RESOLVED] File transfer problems

    I'm transferring a file from client to server.

    On the client I am reading 10,000 bytes at a time and sending the 10,000 bytes using a binary writer to the stream.

    On the server side I am reading these and writing it to a newly created file.

    Now after lots of trial and error I have reached a 'semi working' stage. What happens is I have made a message box appear on the server side showing me the total amount of received bytes out of the total incoming file size. This message box appears every 10,000 bytes received. It appears to work flawless with the message box, except when I disable the message box from appearing it seems to not work. By not working it seems to not receive all the incoming data.

    So the delay the message box is causing seems to be making it work. I am just unsure why.

  2. #2
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: File transfer problems

    Can you replace the Messagebox with DoEvents and see if it will work?
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Dec 2007
    Posts
    70

    Re: File transfer problems

    It helps a bit for smaller files. Anything over a mb or so starts to 'lose' data.

    For example I sent over a 3.97mb .gif file and the server received 3.25mb of it using application.doevents in replace of the message box. Using the message box (and me just holding down enter since it kept popping up) it received the full 3.97mb.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Dec 2007
    Posts
    70

    Re: File transfer problems

    I have resolved my problem. For those who may end up with my same problem in the future this is how I fixed it.

    While I am far from a 'networking' specialist and not exactly sure how it works this is what happened.

    Sending 10,000 bytes at a time to my target server from beginning to end of the file. Without a delay in receiving the bytes the server sometimes received parts of the file out of order. Meaning when I wrote the receiving bytes to a file I was writing the bytes in the incorrect order. My fix was to send the part # of the file with the 10,000 bytes. The first 10,000 would be part 1, 20,000 part 2 and etc. On the server I would keep track of the current part the file is expecting so if the part received wasn't the next part it would simply wait and hold that data until the server caught up the the correct part.

    Ideal way to do it? I have no idea, but it works.

  5. #5
    Junior Member
    Join Date
    Nov 2009
    Posts
    22

    Re: [RESOLVED] File transfer problems

    can you post full code for CLIENT/SERVER file transfer program

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