Timing out calls to wininet.dll

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dan

    #1

    Timing out calls to wininet.dll

    I have an app that uses the wininet.dll APIs to get web pages and to post to
    web forms. My problem is that some of my users systems will literally wait
    an hour before an Internet call to a site that isn't responding times out.
    During this time the app appears to hang since it won't do anything until it
    gets a response to the HTTP request. Does anyone know of a way to enforce a
    time out on calls to wininet? I have read of setting registry entries to
    change the default timeout but this would affect the user's settings for
    Internet Explorer and I don't want to do that. I just want to set a timeout
    for my application.

    Any suggestions would be appreciated!


  • Jeramie

    #2
    Re: Timing out calls to wininet.dll

    Is the process that is calling wininet running on a server or on each
    user's workstation?

    Jeramie

    "Dan" <Dan@NoSpam.com > wrote in message news:<TS-dnb8X8_eF6-qiXTWJig@comcas t.com>...[color=blue]
    > I have an app that uses the wininet.dll APIs to get web pages and to post to
    > web forms. My problem is that some of my users systems will literally wait
    > an hour before an Internet call to a site that isn't responding times out.
    > During this time the app appears to hang since it won't do anything until it
    > gets a response to the HTTP request. Does anyone know of a way to enforce a
    > time out on calls to wininet? I have read of setting registry entries to
    > change the default timeout but this would affect the user's settings for
    > Internet Explorer and I don't want to do that. I just want to set a timeout
    > for my application.
    >
    > Any suggestions would be appreciated![/color]

    Comment

    • Dan

      #3
      Re: Timing out calls to wininet.dll

      "Jeramie" <j_mercker@hotm ail.com> wrote in message
      news:d79899f1.0 310030724.3526a dcb@posting.goo gle.com...[color=blue][color=green]
      > > "Dan" <Dan@NoSpam.com > wrote in message[/color][/color]
      news:<TS-dnb8X8_eF6-qiXTWJig@comcas t.com>...[color=blue][color=green]
      > > I have an app that uses the wininet.dll APIs to get web pages and to[/color][/color]
      post to[color=blue][color=green]
      > > web forms. My problem is that some of my users systems will literally[/color][/color]
      wait[color=blue][color=green]
      > > an hour before an Internet call to a site that isn't responding times[/color][/color]
      out.[color=blue][color=green]
      > > During this time the app appears to hang since it won't do anything[/color][/color]
      until it[color=blue][color=green]
      > > gets a response to the HTTP request. Does anyone know of a way to[/color][/color]
      enforce a[color=blue][color=green]
      > > time out on calls to wininet? I have read of setting registry entries[/color][/color]
      to[color=blue][color=green]
      > > change the default timeout but this would affect the user's settings for
      > > Internet Explorer and I don't want to do that. I just want to set a[/color][/color]
      timeout[color=blue][color=green]
      > > for my application.
      > >
      > > Any suggestions would be appreciated![/color][/color]
      [color=blue]
      > Is the process that is calling wininet running on a server or on each
      > user's workstation?
      >[/color]
      Thanks for responding. It runs on the user's workstation.


      Comment

      • Steve Gerrard

        #4
        Re: Timing out calls to wininet.dll


        "Dan" <Dan@NoSpam.com > wrote in message
        news:TS-dnb8X8_eF6-qiXTWJig@comcas t.com...[color=blue]
        > I have an app that uses the wininet.dll APIs to get web pages and to post to
        > web forms. My problem is that some of my users systems will literally wait
        > an hour before an Internet call to a site that isn't responding times out.
        > During this time the app appears to hang since it won't do anything until it
        > gets a response to the HTTP request. Does anyone know of a way to enforce a
        > time out on calls to wininet? I have read of setting registry entries to
        > change the default timeout but this would affect the user's settings for
        > Internet Explorer and I don't want to do that. I just want to set a timeout
        > for my application.
        >
        > Any suggestions would be appreciated!
        >
        >[/color]

        Here is some selected poop from the MSDN library on general Win32 Internet
        functions (not in VB declaration form):

        InternetSetOpti on Function

        BOOL InternetSetOpti on(
        IN HINTERNET hInternet,
        IN DWORD dwOption,
        IN LPVOID lpBuffer,
        IN DWORD dwBufferLength
        );

        dwOption:
        .....
        INTERNET_OPTION _CONNECT_RETRIE S
        Sets or retrieves an unsigned long integer value that contains the retry count
        to use for Internet connection requests. If a connection attempt still fails
        after the specified number of tries, the request is canceled. The default is
        five retries. This option can be used on any HINTERNET handle, including a NULL
        handle. It is used by InternetQueryOp tion and InternetSetOpti on.

        INTERNET_OPTION _CONNECT_TIMEOU T
        Sets or retrieves an unsigned long integer value that contains the time-out
        value, in milliseconds, to use for Internet connection requests. If a connection
        request takes longer than this time-out value, the request is canceled. This
        option can be used on any HINTERNET handle, including a NULL handle. It is used
        by InternetQueryOp tion and InternetSetOpti on.
        .....

        Hopefully this is useful.
        Steve




        Comment

        • Dan

          #5
          Re: Timing out calls to wininet.dll

          "Steve Gerrard" <notstevegerrar d@comcast.net> wrote in message
          news:3vednd9LRc 0l2OOiXTWJkQ@co mcast.com...[color=blue]
          >
          > "Dan" <Dan@NoSpam.com > wrote in message
          > news:TS-dnb8X8_eF6-qiXTWJig@comcas t.com...[color=green]
          > > I have an app that uses the wininet.dll APIs to get web pages and to[/color][/color]
          post to[color=blue][color=green]
          > > web forms. My problem is that some of my users systems will literally[/color][/color]
          wait[color=blue][color=green]
          > > an hour before an Internet call to a site that isn't responding times[/color][/color]
          out.[color=blue][color=green]
          > > During this time the app appears to hang since it won't do anything[/color][/color]
          until it[color=blue][color=green]
          > > gets a response to the HTTP request. Does anyone know of a way to[/color][/color]
          enforce a[color=blue][color=green]
          > > time out on calls to wininet? I have read of setting registry entries[/color][/color]
          to[color=blue][color=green]
          > > change the default timeout but this would affect the user's settings for
          > > Internet Explorer and I don't want to do that. I just want to set a[/color][/color]
          timeout[color=blue][color=green]
          > > for my application.
          > >
          > > Any suggestions would be appreciated!
          > >
          > >[/color]
          >
          > Here is some selected poop from the MSDN library on general Win32 Internet
          > functions (not in VB declaration form):
          >
          > InternetSetOpti on Function
          >
          > BOOL InternetSetOpti on(
          > IN HINTERNET hInternet,
          > IN DWORD dwOption,
          > IN LPVOID lpBuffer,
          > IN DWORD dwBufferLength
          > );
          >
          > dwOption:
          > ....
          > INTERNET_OPTION _CONNECT_RETRIE S
          > Sets or retrieves an unsigned long integer value that contains the retry[/color]
          count[color=blue]
          > to use for Internet connection requests. If a connection attempt still[/color]
          fails[color=blue]
          > after the specified number of tries, the request is canceled. The default[/color]
          is[color=blue]
          > five retries. This option can be used on any HINTERNET handle, including a[/color]
          NULL[color=blue]
          > handle. It is used by InternetQueryOp tion and InternetSetOpti on.
          >
          > INTERNET_OPTION _CONNECT_TIMEOU T
          > Sets or retrieves an unsigned long integer value that contains the[/color]
          time-out[color=blue]
          > value, in milliseconds, to use for Internet connection requests. If a[/color]
          connection[color=blue]
          > request takes longer than this time-out value, the request is canceled.[/color]
          This[color=blue]
          > option can be used on any HINTERNET handle, including a NULL handle. It is[/color]
          used[color=blue]
          > by InternetQueryOp tion and InternetSetOpti on.
          > ....
          >
          > Hopefully this is useful.
          > Steve[/color]

          Steve,

          Thanks very much for your help! I'm not certain how to apply the above.
          What I think I really need is a good book for VB programmers on using the
          Wininet API since I'm not much of a low level programmer (took a couple C
          classes about 8 years ago and haven't looked at it since). Do you know of a
          Wininet API for dummies type book? ;-)


          Comment

          • Jeramie

            #6
            Re: Timing out calls to wininet.dll

            Hi Dan - I'd suggest getting Dan Appleman's book on the Win32 API for
            VB programmers (it should still be in print). It covers how to map
            the C/C++ declarations into VB declares. I don't think it mentions
            anything about the WinInet stuff, but would help with the translation.
            You may also be able to find a good resource online that would give
            you the same information.

            Jeramie

            "Dan" <Dan@NoSpam.com > wrote in message news:<_OSdndHJz PgWDeKiU-KYuA@comcast.co m>...[color=blue]
            > "Steve Gerrard" <notstevegerrar d@comcast.net> wrote in message
            > news:3vednd9LRc 0l2OOiXTWJkQ@co mcast.com...[color=green]
            > >
            > > "Dan" <Dan@NoSpam.com > wrote in message
            > > news:TS-dnb8X8_eF6-qiXTWJig@comcas t.com...[color=darkred]
            > > > I have an app that uses the wininet.dll APIs to get web pages and to[/color][/color]
            > post to[color=green][color=darkred]
            > > > web forms. My problem is that some of my users systems will literally[/color][/color]
            > wait[color=green][color=darkred]
            > > > an hour before an Internet call to a site that isn't responding times[/color][/color]
            > out.[color=green][color=darkred]
            > > > During this time the app appears to hang since it won't do anything[/color][/color]
            > until it[color=green][color=darkred]
            > > > gets a response to the HTTP request. Does anyone know of a way to[/color][/color]
            > enforce a[color=green][color=darkred]
            > > > time out on calls to wininet? I have read of setting registry entries[/color][/color]
            > to[color=green][color=darkred]
            > > > change the default timeout but this would affect the user's settings for
            > > > Internet Explorer and I don't want to do that. I just want to set a[/color][/color]
            > timeout[color=green][color=darkred]
            > > > for my application.
            > > >
            > > > Any suggestions would be appreciated!
            > > >
            > > >[/color]
            > >
            > > Here is some selected poop from the MSDN library on general Win32 Internet
            > > functions (not in VB declaration form):
            > >
            > > InternetSetOpti on Function
            > >
            > > BOOL InternetSetOpti on(
            > > IN HINTERNET hInternet,
            > > IN DWORD dwOption,
            > > IN LPVOID lpBuffer,
            > > IN DWORD dwBufferLength
            > > );
            > >
            > > dwOption:
            > > ....
            > > INTERNET_OPTION _CONNECT_RETRIE S
            > > Sets or retrieves an unsigned long integer value that contains the retry[/color]
            > count[color=green]
            > > to use for Internet connection requests. If a connection attempt still[/color]
            > fails[color=green]
            > > after the specified number of tries, the request is canceled. The default[/color]
            > is[color=green]
            > > five retries. This option can be used on any HINTERNET handle, including a[/color]
            > NULL[color=green]
            > > handle. It is used by InternetQueryOp tion and InternetSetOpti on.
            > >
            > > INTERNET_OPTION _CONNECT_TIMEOU T
            > > Sets or retrieves an unsigned long integer value that contains the[/color]
            > time-out[color=green]
            > > value, in milliseconds, to use for Internet connection requests. If a[/color]
            > connection[color=green]
            > > request takes longer than this time-out value, the request is canceled.[/color]
            > This[color=green]
            > > option can be used on any HINTERNET handle, including a NULL handle. It is[/color]
            > used[color=green]
            > > by InternetQueryOp tion and InternetSetOpti on.
            > > ....
            > >
            > > Hopefully this is useful.
            > > Steve[/color]
            >
            > Steve,
            >
            > Thanks very much for your help! I'm not certain how to apply the above.
            > What I think I really need is a good book for VB programmers on using the
            > Wininet API since I'm not much of a low level programmer (took a couple C
            > classes about 8 years ago and haven't looked at it since). Do you know of a
            > Wininet API for dummies type book? ;-)[/color]

            Comment

            • J French

              #7
              Re: Timing out calls to wininet.dll

              On 14 Oct 2003 12:49:33 -0700, j_mercker@hotma il.com (Jeramie) wrote:
              [color=blue]
              >Hi Dan - I'd suggest getting Dan Appleman's book on the Win32 API for
              >VB programmers (it should still be in print). It covers how to map
              >the C/C++ declarations into VB declares. I don't think it mentions
              >anything about the WinInet stuff, but would help with the translation.
              > You may also be able to find a good resource online that would give
              >you the same information.
              >[/color]

              eg: the downloadable API Guide from :


              Comment

              Working...