471,336 Members | 1,253 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Problem reading messages async after doing an enum at app-start [.Net 1.1]

Hi All,

I have a problem reading queue-messages async. My QueueReader has a Start()
and a Stop() method and if my app starts, it calls Start(). The problem is,
that there are possibly several hundreds of messages in the queue, which I
do not want to have processed by the async messagehandler at startup. So in
Start(), I create a new thread, which's method [called PreRead] just simply
enums the queue-messages [and processes them including remove]. At the end
of this thread, I fire an event. The eventhandler in turn executes a
"queue.BeginReceive()" and assigns the messagehandler to initiate async
processing. The messagehandler is then immidiately called, but hungs
forever. It hangs at

private void OnReceiveCompleted(Object source, ReceiveCompletedEventArgs
asyncResult)
{
MessageQueue q = (MessageQueue) source;
Message m = q.EndReceive(asyncResult.AsyncResult); //<< hungs.

The astoundig think is first, that the message-receiver is immidiately
called. My PreRead method uses a local queue object and all resources are
releases properly. I tried also to skip all that queue-processing in PreRead
and only fire the event finally. Event this leads to the same behavior.
So it looks like, if I start async reading from a different thread, it is
not working.

I use Windows 2000, en, SP4, all fixes, .Net 1.1, SP1

Any helpf would be great!

Best regards,
Manfred Braun

(Private)
Lange Roetterstrasse 7
D68167 Mannheim
Germany

mailto:manfred.braun-at-manfbraun.de
(Remove the anti-spam-"-at-" to mail me!)
Nov 26 '05 #1
0 1149

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Jonas | last post: by
10 posts views Thread by dof | last post: by
1 post views Thread by Thomas Lerchner | last post: by
1 post views Thread by Randy | last post: by
2 posts views Thread by Randy | last post: by
1 post views Thread by Demi | last post: by
reply views Thread by Slawomir Nasiadka | last post: by

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.