To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
VBForums  

VB Wire News
Part 10 of the Visual Basic .NET 2010 Express Tutorial Complete!
How to Use the Visual Studio Code Analysis Tool FxCop
Article :: Interview with Andrei Alexandrescu (Part 3 of 3)
Introducing Visual Studio LightSwitch
Visual Studio LightSwitch Beta 1 is Available



Go Back   VBForums > Visual Basic > Network Programming

Reply Post New Thread
 
Thread Tools Display Modes
Old Nov 24th, 2009, 10:52 PM   #1
Disyne
Lively Member
 
Join Date: Dec 07
Posts: 70
Disyne is an unknown quantity at this point (<10)
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.
Disyne is offline   Reply With Quote
Old Nov 25th, 2009, 12:56 AM   #2
dee-u
Software Carpenter
 
dee-u's Avatar
 
Join Date: Feb 05
Location: Philippines
Posts: 9,747
dee-u is a splendid one to behold (700+)dee-u is a splendid one to behold (700+)dee-u is a splendid one to behold (700+)dee-u is a splendid one to behold (700+)dee-u is a splendid one to behold (700+)dee-u is a splendid one to behold (700+)dee-u is a splendid one to behold (700+)dee-u is a splendid one to behold (700+)
Re: File transfer problems

Can you replace the Messagebox with DoEvents and see if it will work?
dee-u is offline   Reply With Quote
Old Nov 25th, 2009, 10:03 AM   #3
Disyne
Lively Member
 
Join Date: Dec 07
Posts: 70
Disyne is an unknown quantity at this point (<10)
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.
Disyne is offline   Reply With Quote
Old Nov 27th, 2009, 10:54 PM   #4
Disyne
Lively Member
 
Join Date: Dec 07
Posts: 70
Disyne is an unknown quantity at this point (<10)
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.
Disyne is offline   Reply With Quote
Old Nov 30th, 2009, 04:52 PM   #5
yuvarajv
Junior Member
 
Join Date: Nov 09
Posts: 22
yuvarajv is an unknown quantity at this point (<10)
Re: [RESOLVED] File transfer problems

can you post full code for CLIENT/SERVER file transfer program
yuvarajv is offline   Reply With Quote
Reply

Go Back   VBForums > Visual Basic > Network Programming


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 05:32 AM.





Acceptable Use Policy

Internet.com
The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.