| Dart Home | PowerTCP FTP for .NET | Custom Development | Reply | PowerTCP FTP for .NET Topics | Forums |
| Author | Forum: PowerTCP FTP for .NET Topic: Multipart downloads |
| kalesleadingham From: dubbo, AR Uzbekistan Posts: 4 Member Since: 02/26/03 |
posted February 26, 2003 9:25 PM Hi, Is FTP for .NET capable of doing multipart downloads? I don't think it is, but maybe someone with more skill than me has found a way. Alternatively, are there any plans for future versions to include this functionality? It doesn't seem to be a very popular feature to include in FTP clients or components, but we've found it to greatly improve performance over some of our links (using other programs inappropriate for this application). Just to clarify - by multipart, I mean downloading a single file in several smaller chunks simultaneously (similar to FlashGet). Thanks, Tim |
K M Drake![]() From: Utica, NY USA Posts: 3406 Member Since: 07/14/00 |
posted February 27, 2003 11:50 AM Hi Tim, We don't have a sample of this, but it should be possible using the Ftp.BeginGet Method (String, Int64, Object) (see this overloaded method in the help). If it were me, I would create a class with two properties - Start and Size, and create an instance of this to pass in as the third parameter of the BeginGet call. Start would be where to start the download, and Size the amount of data to retrieve. Then, in the EndGet event, the stream would be read into a byte array, and the transfer aborted(as demonstrated in the help). After all transfers had finished, the combined array could then be written to a file on disk. Hope it helps, -ken |
| kalesleadingham From: dubbo, AR Uzbekistan Posts: 4 Member Since: 02/26/03 |
posted March 4, 2003 10:58 PM Hi Ken, Thanks for the suggestions - I'm almost there. The biggest problem I'm currently having is a System.Net.Sockets.SocketException towards the end of receiving the last part: "A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no address was supplied". Any idea what could be causing this error? It happens more often than not regardless of the number of parts I split the file into. Some times I can resume from where the error occurred, other times the error just keeps happening. Secondly, and perhaps this is just because I'm silly, the RestartMarker (Int64) seems to be a bit misleading. To get from the start of the file, I use 0. If I've downloaded 12 bytes and want to start at the 13th byte, I would expect the restart marker to be 12. However, if I use the number of bytes already downloaded I always end up skipping a byte. So in this case, If I set the restart marker to 12, the first byte I get is actually the 14th. Thanks, Tim |
| kalesleadingham From: dubbo, AR Uzbekistan Posts: 4 Member Since: 02/26/03 |
posted March 5, 2003 12:44 AM Hi agaon... I have managed to overcome the socket error by using while (s.Available > 0), but in doing so have ontroduced a new problem related, I expect, to the RestartMarker problem. I end up 11 bytes short when I combine the files from a five part transfer. I think I might be able to fix this by subtracting the zero-based part number from what I would expect the RestartMarker to be, but I can't test it because of the error below... One additional problem which I thought I had overcome but which has returned: Despite making sure that I only write as much as I read, the completed files tend to have too many zeros when I open them in a hex editor to check for differences. Sorry to be such a hassle, Tim |
K M Drake![]() From: Utica, NY USA Posts: 3406 Member Since: 07/14/00 |
posted March 6, 2003 10:04 AM Hi Tim, I have put together a quick little project that seems to work ok for me. If you would like me to send it to you, please email support@dart.com and reference this thread. Thanks, -ken |
| kalesleadingham From: dubbo, AR Uzbekistan Posts: 4 Member Since: 02/26/03 |
posted March 6, 2003 6:12 PM Hi Ken, Thanks agaon for your help - I actually have it working now. The errors were largely due to my own stupidity, but the RestartMarker thing seemed to be solved by me upgrading the to latest version of the control. Tim |
| Reply | PowerTCP FTP for .NET Topics | Forums |
This site is powered by
PowerTCP WebServer for ActiveX
|