-
Mar 15th, 2013, 12:35 AM
#1
Thread Starter
Addicted Member
Error while file download using winsock
We are using vb6 winsock for downloading files.It works fine for lot of our customers. But only for some 5 customers the file does not get downloaded properly. The request is like shown below
GET http://www.abc.com/files/Web_236.txt HTTP/1.0
Host: www.abc.com
Accept: *.*, */*
Range: bytes=0-641
User-Agent: Winman Software (P) Ltd.
Referer: www.abc.com
GET http://www.abc.com/files/Web_236.txt HTTP/1.0
Host: www.abc.com
Accept: *.*, */*
Range: bytes=642-1283
User-Agent: Winman Software (P) Ltd.
Referer: www.abc.com
The problem is that in some system where Full file part is downloaded 2 times. Why does this error happens?
Last edited by winman; Mar 15th, 2013 at 04:00 AM.
-
Mar 15th, 2013, 04:03 AM
#2
Re: Error while file download using winsock
This is a routine enough thing.
But I fail to understand why anyone would use a TCP socket and try to implement HTTP on top of it. There are at least 5 different ways a VB6 program can make HTTP requests without 3rd party libraries and without manually "rolling your own" HTTP protocol logic.
It is hard to imagine what would be accomplished by retrieving a file in such tiny chunks anyway. Range requests are normally done for unusual things like when you only need a portion of a resource (file) or for recovery from failed transfers.
The most obvious thing to suspect here is that some of the servers being hit do not support Range headers for the requested resource. But I'd expect any server refusing Range headers to reply with a 5xx error of some kind rather than returning the prior range of data a second time. The fact that you get the prior range of bytes a second time makes this even more suspicious.
This would seem to point to a client-side bug, i.e. your code.
Since we haven't seen your code (and probably don't really want to look at 5000 lines of snarl or out of context snippets) it is hard to suggest anything else. If you can create a minimal example that reproduces the problem it might be something we could look at though.
In attempting to create such an example you might find the trouble yourself.
-
Mar 15th, 2013, 06:35 AM
#3
Thread Starter
Addicted Member
Re: Error while file download using winsock
But the error came only in some pc. In about 1 PC outof 10000 PC.
-
Mar 15th, 2013, 06:52 AM
#4
Re: Error while file download using winsock
Well with the information provided there isn't much we can do to help. If I had to guess I'd assume your problem is either in your handling of Winsock received data or your processing of HTTP responses.
Both of those go away completely if you had used an HTTP component to do this instead. The obvious choices here would be the XmlHttpRequest object or the WinHttpRequest object. Both have been preinstalled as part of Windows for a long time. MSXML.XmlHttpRequest version 3 can be deployed along with your application as far back as Windows 95 but it would be a very rare Win95 system that doesn't already have it.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|