Thread: winInet cache

  1. #1
    Registered User
    Join Date
    Jun 2007
    Posts
    1

    winInet cache

    hi all,
    im using the wininet library to download files from the net--web cam pics to be precise and the problem is, after downloading a pic once i always get the same pic in later trys. seems to have to do with windows internal buffering. while the pic of the webcam obviously changes all the time, the InternetReadFile() only gives me the pic which is already in the buffer.
    i've tried to close and reopen the whole session with InternetOpen() and InternetCloseHandle() but same result. only way is restarting the program.
    is there any way to clear that damn cache??
    thanks

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    At a guess, the webcam is using a streaming protocol, and you need a different API.

    AFAIK, InternetReadFile() is for content whose size can be determined in advance.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    You could try one of the cache flags in your call to InternetOpenUrl or HttpOpenRequest: INTERNET_FLAG_RELOAD or INTERNET_FLAG_PRAGMA_NOCACHE.

  4. #4
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,195
    Quote Originally Posted by Salem View Post
    AFAIK, InternetReadFile() is for content whose size can be determined in advance.
    Not true, i use InternetReadFile() to GET streaming video and it works just fine. I believe you want to use
    INTERNET_FLAG_KEEP_CONNECTION | INTERNET_FLAG_PRAGMA_NOCACHE
    for streaming content though.
    Code:
    hRequest = HttpOpenRequest( hConnection , NULL , (char *)&szFile , NULL , NULL , (const char **)lpMIME , INTERNET_FLAG_KEEP_CONNECTION | INTERNET_FLAG_PRAGMA_NOCACHE , 0 );

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. need help with cache simulator!
    By dtogers123 in forum C Programming
    Replies: 3
    Last Post: 04-30-2008, 06:18 PM
  2. ideas requested for a CACHE.
    By bean66 in forum C Programming
    Replies: 2
    Last Post: 02-21-2008, 11:01 AM
  3. Resource manager tree
    By VirtualAce in forum Game Programming
    Replies: 23
    Last Post: 09-07-2007, 10:27 PM
  4. added start menu crashes game
    By avgprogamerjoe in forum Game Programming
    Replies: 6
    Last Post: 08-29-2007, 01:30 PM
  5. cache miss/hit
    By xddxogm3 in forum C++ Programming
    Replies: 3
    Last Post: 05-07-2007, 06:51 PM