Does HTTP Protocol support random access?

When I use InternetSetFilePointer to read a block of data at position 100000 ,I found it only workes after all data before 100000 has been downloaded, and that is not what I want. Can anyone tell me why?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

DWORD           dwStartFrom;
CString            temp;
temp.Format("Range: bytes=%d-",dwStartFrom);

Insert this code after successfully submitting the
This works with most servers. Some won't support this,

The reason why your method not works lies within the
Internet API. Can't tell you exactly :(
But this is part of a working application and should
make no problems.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
you can tell if a server supports this if it supports resuming downloads
linyfAuthor Commented:
   Thank you very much! The mean you tell me really works.
But I still have a most headache problem: What I really want to do is to randomly read data from a file on a Internet Server just like from a local file by using file function Seek(). I tried, and found Http is not an appropriate protocol, because it is too slow. I want to know if there exists another protocol that meet my need?
Such a protocol does need many functions, just provide service that I can use to read/write data like an random access file.

Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

Umm ...
Internet protocols aren't designed for random access

One approach could be to split the file you want to access
into 1-4 kb portions (choose the size which won't create
unused space on your hard disk = cluster size).

Another approach is maybe to use server side CGI scripts,
which do the random access for you, and deliver you
HTTP pages filled with the information you need.

If you would use 'sockets' directly, maybe FTP would be fast
enough for you. Some commands like these can perform 'random'


(2.) REST (random access position)
(3.) RETR my_file.dat
Read as long as you need, then
(4.) ABOR

Then proceed with step (2.) until you're done
(5.) QUIT

Let me know if this is interesting, i've got some links
somewhere to a FTP wrapper class to make it easier to implement.
If you are using servers where you have access right you may be better off write a server side script which does the file IO and you just tell it what to do..

linyfAuthor Commented:
Thank you !
   Your comment is right. But I can't split my file into small pieces, because I format the file just like a database, and want to query data from the file by network.
  I don't know whether FTP is fast enough for random accessing, if it not, it seems I have to reformat my file from scratch.
  I am very interesting in the FTP wrapper class you 've mentioned ,can you tell me where to get it?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.