469,964 Members | 1,683 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,964 developers. It's quick & easy.

synchronization problem in remouting events handling

Hi,
I have got some problem with sending of events in .NET.
I am using remouting.
The client has got 2 objects for receiving different types of events
(responses and events)
The server has got two objects for sending of these events.
The client opens tcp port 0 to receive events:
if (ChannelServices.GetChannel("tcp") == null)

{

BinaryClientFormatterSinkProvider provider = new
BinaryClientFormatterSinkProvider();
IDictionary props = new Hashtable();

props["port"] = 0;
TcpChannel chan = new TcpChannel(props, provider, null);

ChannelServices.RegisterChannel( chan );

}

and the client supplies to the server 2 delegates for the different kinds of
the events. These callbacks are added to an event table.

When the event or the response occured , it is being sent to the client
from the thread corresponding to the event or response object.

The problem occurs when the server is sending simultaneously response and
event to the same client (from the different thread).

The client receives only the response (that is sent the first always). The
event is seems to be stuck in the delegate callback:

...........

printDebugMsg(string.Format("before sending of event
{0}",eventData.eventType));
cbDelegateEvent(obj,eventData);

printDebugMsg(string.Format("after sending of event
{0}",eventData.eventType));

............

I am receiving something like the following :

before sending of event RESPONSE

before sending of event EVENT

after sending of event RESPONSE.

And it's all.

I have added debug printings on the client side and saw that the event does
not arrive to the client at all.

After the client was disconnected from the server , it(the client) received
all the relevant stuck events.

I fixed the problem by synchronization of the response and event threads
thus that only one call to the client side can be processed at the same
time.

Cannot I send 2 events from the 2 threads to the same client at the same
time?

I wouldn't want to use synchronization. Maybe there is another solution
(something with RegisterChannel )?

Thanks

Efim
Nov 15 '05 #1
0 1257

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Ivan | last post: by
7 posts views Thread by Ivan | last post: by
12 posts views Thread by scsharma | last post: by
7 posts views Thread by Robert | last post: by
12 posts views Thread by emma_middlebrook | last post: by
1 post views Thread by rainxy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.