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

High performance UDP Listener?

P: n/a
I am working on an application that needs a high performance UDP Listener.

Currently I have one thread listening to the network and handling the
requests. Currently I need about 70 MS between packets so I dont drop
anything.

I think I need one thread listening to the network and another thread
handling requests. I dont know if I would need an "array queue" to hold
the messages or if I could just use the RaiseEvent signal to notify the
worker thread to process the inbound message.

Anyone seen a code sample/article that could help me out?

g.
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
I did something very similar before with MSMQ. Does it take much time to
process the incoming UDP requests? If not, you could listen on one thread, as
you said, and simply pass the request to the ThreadPool, using the
QueueUserWorkItem method. If it does take a long time to process a request, I
would not advise using the threadpool as it could become starved quickly. In
this scenario, either create new Thread objects manually (which is the quick
option, but could degrade performance if you have too many threads running at
once, leading to too many context switches), or grab the source for one of
the many custom thread pools out there.

Hope this helps.
Dan

"gregory_may" wrote:
I am working on an application that needs a high performance UDP Listener.

Currently I have one thread listening to the network and handling the
requests. Currently I need about 70 MS between packets so I dont drop
anything.

I think I need one thread listening to the network and another thread
handling requests. I dont know if I would need an "array queue" to hold
the messages or if I could just use the RaiseEvent signal to notify the
worker thread to process the inbound message.

Anyone seen a code sample/article that could help me out?

g.

Nov 21 '05 #2

P: n/a
Processing is probably 50 Ms or so, its pretty quick. I will check out the
QueueUserWorkItem you mentioned. I dont expect I should ever have more than
2-3 threads processing at once.

The other article you mentioned (From my previous post) gave an outline of
using the threadpool, I will give it a try:
http://www.yoda.arachsys.com/csharp/threads/

Thanks!
"Dan Kelley" <Da*******@discussions.microsoft.com> wrote in message
news:A9**********************************@microsof t.com...
I did something very similar before with MSMQ. Does it take much time to
process the incoming UDP requests? If not, you could listen on one thread,
as
you said, and simply pass the request to the ThreadPool, using the
QueueUserWorkItem method. If it does take a long time to process a
request, I
would not advise using the threadpool as it could become starved quickly.
In
this scenario, either create new Thread objects manually (which is the
quick
option, but could degrade performance if you have too many threads running
at
once, leading to too many context switches), or grab the source for one of
the many custom thread pools out there.

Hope this helps.
Dan

"gregory_may" wrote:
I am working on an application that needs a high performance UDP
Listener.

Currently I have one thread listening to the network and handling the
requests. Currently I need about 70 MS between packets so I dont drop
anything.

I think I need one thread listening to the network and another thread
handling requests. I dont know if I would need an "array queue" to hold
the messages or if I could just use the RaiseEvent signal to notify the
worker thread to process the inbound message.

Anyone seen a code sample/article that could help me out?

g.

Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.