473,396 Members | 2,024 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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

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
3 2170
"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
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
"Tom" <to**********@gmail.comschrieb
Thank you very much Armin, that information was very much appreciated :)
Was a pleasure :)
Armin
Jul 31 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: rajamanickam | last post by:
Hi all, I am using HttpListener class of VS2005 to send HTTP response . i am writing data by outputStream and closing ResponseContext. Even i used stream.flush, stream.close methods, i am getting...
1
by: Antimon | last post by:
Hi, Anyone using the new System.Net.HttpListener class included in 2.0? How about the performance? And can it register for example "http://host:80/app" to use with iis running website on...
3
by: Martin | last post by:
How does one set up basic authentication on an HttpListener? I know I need to set the HttpListener.AuthenticationSchemes to AuthenticationSchemes.Basic but then I'm unsure how and against what...
1
by: googlegroups | last post by:
Hello everyone, I need a new web server for our existing website and I don't want subscribe to the whole IIS way of doing things. I thought I would implement a custom web server using the new...
5
by: davesmith | last post by:
I have a very simple console app using an HttpListener to listen for incoming HTTP requests (see code below). My client and server machines are both in an ADS domain and I'm logged into both using...
7
by: Pro1712 | last post by:
Hello, I need to write a simple proxy server. What I want to do is to use HttpListener to get requests from the browser, add some proxy information and some other stuff and send the request to...
1
by: =?Utf-8?B?V2lsZCBXaWxkIE1pa2U=?= | last post by:
I have a windows service implementation that creates an HttpListener in OnStart to help capture port conflict issues while starting vs. when the service is already started. On Windows 2003 servers...
1
by: khanhnk | last post by:
Hi, I'm using an HttpListener class to receive posts in my Windows Forms application. These posts contain several pictures in multipart mime format. Unfortunately, the HttpListenerRequest class...
3
by: Hans-Jürgen Philippi | last post by:
Hi Group, I've created a (very simple) ASP.NET web application with a single *.aspx page and an *.aspx.cs CodeBehind file: By clicking an HTML form button, a text control value is written into a...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.