CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2008
    Posts
    39

    Smile HttpSendRequest() failed

    Hello, I've implemented the application to download the file from server with resume feature. Application uses the WinInet http protocol API to download file. Initially Request is sent to the server using HttpSendRquest() without any adding header. For second time, header is added to request using HttpAddRequestHeaders() for range field(to download file from perticular offset) and it sends the request using HttpSendRequest(). But HttpSendRequest() takes long time(nearly 6 to 8 mins) or sometimes it is timeout. So, why HttpSendRequest() takes long time to send request for the second time with header for range field? And it works properly if no header is added for range field to the request.

    Please, reply me as soon as possible.
    Last edited by sunil_guru; February 10th, 2009 at 06:00 AM.

  2. #2
    Join Date
    Dec 2006
    Posts
    37

    Re: HttpSendRequest() failed

    Hi sunil_guru,

    I have been using the same api in my project.

    I have also encountered the same problem of time out.

    Time out may occur if the message of file you are downloading is large and internet connection is slow. What you can try is that set some time out large enough so that time out does not occur.

    DWORD dwTimeOut = 1000*60*30;

    ::InternetSetOption(hRequest,
    INTERNET_OPTION_RECEIVE_TIMEOUT,
    &dwTimeOut,
    sizeof(dwTimeOut));

    ::InternetSetOption(hRequest,
    INTERNET_OPTION_SEND_TIMEOUT,
    &dwTimeOut,
    sizeof(dwTimeOut));

    Regarding the header I have always added the header in the first place when the requet being made. And closed the connection after succesfull request sending and receiving.

    So the reason for this problem I may not help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured