Does HTTP Protocol support random access?

Posted on 1999-06-28
Medium Priority
Last Modified: 2013-11-20
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?
Question by:linyf
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2

Accepted Solution

snoegler earned 800 total points
ID: 1308162
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.

Expert Comment

ID: 1308163
you can tell if a server supports this if it supports resuming downloads

Author Comment

ID: 1308164
   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.

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf


Expert Comment

ID: 1308165
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.

Expert Comment

ID: 1308166
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..


Author Comment

ID: 1308167
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?

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question