By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,287 Members | 1,668 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,287 IT Pros & Developers. It's quick & easy.

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

P: n/a
Tom
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.DoEvents()
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
Jul 31 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"Tom" <to**********@gmail.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.DoEvents()
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.ExitThread.
Armin
Jul 31 '07 #2

P: n/a
Tom
Thank you very much Armin, that information was very much appreciated :)
Armin Zingler wrote:
"Tom" <to**********@gmail.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.DoEvents()
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.ExitThread.
Armin
Jul 31 '07 #3

P: n/a
"Tom" <to**********@gmail.comschrieb
Thank you very much Armin, that information was very much appreciated :)
Was a pleasure :)
Armin
Jul 31 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.