I know this is of no help at all, but I also witnessed this behavior.
No matter what I do on the client, the server is called synchronously. I
tried multiple concurrent asynchronous client calls. I got concurrent
server calls, but they were all synchronous calls (SyncProcessMessage
was called multiple times in several threads).

  It actually makes a lot of sense to me that the nature of the call in
the server doesn't depend on the call in the client. I guess
asynchrnonous server calls happen when remoting is not used (calling
across app domains or contexts in the same process). I didn't try it
out, though.

  Itay.

-----Original Message-----
From: Uriel Cohen [mailto:[EMAIL PROTECTED] 
Sent: Sunday, April 30, 2006 3:37 PM
Subject: Async call in Remote server with custom sink

Hi!

I have the following problem which has been puzzling me for a while.
I am trying to intercept an asynchroneous call in a remote server while
using an IMessageSink that I provided.

The sink is created by attaching to my wellknown singleton object (which
is first created and only then marshalled with the
RemotingServices.Marshal
method) an attribute that inherits ContextAttribute. This attribute adds
a ContextProperty which implements IContextProperty and
IContributeObjectSink, thus creating my IMessageSink. My message sink is
very simple:

public IMessage SyncProcessMessage(IMessage msg) {
    Console.WriteLine("SyncProcessMessage: {0}", ((IMethodMessage)
msg).MethodName);
    return nextSink.SyncProcessMessage(msg); }

public IMessageCtrl AsyncProcessMessage(IMessage msg, IMessageSink
replySink)
{
    Console.WriteLine("AsyncProcessMessage: {0}", ((IMethodMessage)
msg).MethodName);
    return nextSink.AsyncProcessMessage(msg, replySink); }

When I made calls to my object from the client, I see the Sync call
printed out to the Console window as expected, but I cannot manage to
get the AsyncProcessMessage called in any circumstance. I tried doing
the following in my client:

int i = 0;
DoSomethingDelegate del = new DoSomethingDelegate(server.DoSomething);
IAsyncResult asyncRes = del.BeginInvoke(i, null, null);
Thread.Sleep(1000); del.EndInvoke(asyncRes);

And it didn't work. I tried also marking the DoSomething method of the
server with [OneWay] and removing the EndInvoke part, but it didn't
worked either.

I would appreciate any help that could be provided.
I have the entire solution of this simple example and I can send it by
mail to anyone.

===================================
This list is hosted by DevelopMentor(r)  http://www.develop.com

View archives and manage your subscription(s) at
http://discuss.develop.com

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to