Groups | Blog | Home
all groups > dotnet remoting > october 2007 >

dotnet remoting : [OneWay] and IPC channel - does not work?!?!


js
10/19/2007 1:50:22 PM
Hi,

I have observed strange behavior with the IpcChannel and methods
marked as [OneWay]. It seems that they can be called only a fixed
number of times and after the limit is reached they do not appear on
server anymore. It can be seen even in a simplest sample application
(I include the code below). On my computer only the first 25 calls are
handled correctly and after that no call reaches the server. It does
not depend on how quickly the calls are made - even if I put a lot of
delay between client calls, the server stops at 25th call.

I guess it is a problem with the thread pool somehow not handled
correctly inside the remoting infrastructure. Interestingly, on
another computer the limit is 50 calls but this one is a dual core
machine which perhaps doubles the number.

If I switch to TCP channel, things work as expected.

For me it is a serious bug and makes [OneWay] and IPC combination
completely useless.

Any comments or explanations?
Jakub

Sample code

--- Server interface and implementation


public interface IServer
{
[OneWay]
void Ping(int num);
}


class ServerImpl : MarshalByRefObject, IServer
{

[OneWay]
public void Ping(int num)
{
Console.WriteLine("Ping received: " + num);
}
}


--- Server application

class Program
{
static void Main(string[] args)
{
Hashtable props = new Hashtable();
props["portName"] = "SERVER";
IpcChannel ic = new IpcChannel(props, null, null);
ChannelServices.RegisterChannel(ic, false);


ServerImpl server = new ServerImpl();
RemotingServices.Marshal(server, "SERVER");

Console.ReadLine();
}
}

--- Client application

class Program
{
static void Main(string[] args)
{
Hashtable props = new Hashtable();
props["portName"] = "CLIENT";
IpcChannel ic = new IpcChannel(props, null, null);
ChannelServices.RegisterChannel(ic, false);

IServer server =
(IServer)Activator.GetObject(typeof(IServer), "ipc://SERVER/SERVER");

int num = 1;
while (!Console.KeyAvailable)
{
Console.WriteLine("Ping sent: " + num);
server.Ping(num);
Thread.Sleep(1000);
num++;
}

}
}

--- Client output
Ping sent: 1
Ping sent: 2
Ping sent: 3
Ping sent: 4
.....
Ping sent: 24
Ping sent: 25
Ping sent: 26
Ping sent: 27
.....
(forever)

--- Server output
Ping received: 1
Ping received: 2
Ping received: 3
Ping received: 4
.....
Ping received: 24
Ping received: 25
(and that's all...)
js
10/19/2007 2:04:17 PM
Sorry, the original subject was "[OneWay] and IPC channel - does not
work?!?!" but for some reason Google decided to cut [OneWay] from
it...

J.



AddThis Social Bookmark Button