Program with HTTPListener is idling at 100% cpu...

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

    Program with HTTPListener is idling at 100% cpu...

    Hey,

    I have made a program, that simply runs as a tray icon in the
    systemtray, providing a HTTP Server using HTTPListener.

    I have one problem however, it idles at 70-100% cpu.

    It could be 1 of 2 things:

    1) In my Sub Main i have:

    Sub Main()
    While CloseProgram = False
    Application.DoE vents()
    End While
    End Sub

    I didn't quite know how to do it otherwise (Stop the program closing as
    its just a tray icon and no windows forms are present), or its

    2) The HTTPListener being greedy.

    Any Ideas?

    Cheers
  • Armin Zingler

    #2
    Re: Program with HTTPListener is idling at 100% cpu...

    "Tom" <tomrleighton@g mail.comschrieb
    Hey,
    >
    I have made a program, that simply runs as a tray icon in the
    systemtray, providing a HTTP Server using HTTPListener.
    >
    I have one problem however, it idles at 70-100% cpu.
    >
    It could be 1 of 2 things:
    >
    1) In my Sub Main i have:
    >
    Sub Main()
    While CloseProgram = False
    Application.DoE vents()
    End While
    End Sub
    >
    I didn't quite know how to do it otherwise (Stop the program closing
    as its just a tray icon and no windows forms are present), or its
    >
    2) The HTTPListener being greedy.
    >
    Any Ideas?

    Replace your loop by

    Application.Run

    And instead of setting CloseProgram = True, call Application.Exi tThread.


    Armin

    Comment

    • Tom

      #3
      Re: Program with HTTPListener is idling at 100% cpu...

      Thank you very much Armin, that information was very much appreciated :)


      Armin Zingler wrote:
      "Tom" <tomrleighton@g mail.comschrieb
      >Hey,
      >>
      >I have made a program, that simply runs as a tray icon in the
      >systemtray, providing a HTTP Server using HTTPListener.
      >>
      >I have one problem however, it idles at 70-100% cpu.
      >>
      >It could be 1 of 2 things:
      >>
      >1) In my Sub Main i have:
      >>
      > Sub Main()
      > While CloseProgram = False
      > Application.DoE vents()
      > End While
      > End Sub
      >>
      >I didn't quite know how to do it otherwise (Stop the program closing
      >as its just a tray icon and no windows forms are present), or its
      >>
      >2) The HTTPListener being greedy.
      >>
      >Any Ideas?
      >
      >
      Replace your loop by
      Application.Run
      >
      And instead of setting CloseProgram = True, call Application.Exi tThread.
      >
      >
      Armin

      Comment

      • Armin Zingler

        #4
        Re: Program with HTTPListener is idling at 100% cpu...

        "Tom" <tomrleighton@g mail.comschrieb
        Thank you very much Armin, that information was very much appreciated :)
        Was a pleasure :)


        Armin

        Comment

        Working...