Click to See Complete Forum and Search --> : Remoting client channel


a_k_
April 10th, 2007, 01:24 PM
Should each .NET Remoting client create a new channel and unregister it after use in multithreaded client system, when different threads on the client side may activate the same remoting object on the server side simultaniously? We use WellKnown SingleCall object accessible via TCP channel.

Thank you,
a_k_

MadHatter
April 10th, 2007, 01:54 PM
client??? clients aren't as important as the server objects. you should be ok without messing with the client. if you have multiple threads that may publish / revoke the server object, then yea, you need to manage that.

a_k_
April 10th, 2007, 02:18 PM
Thank you very much for your reply

Regarding the client - is it possible that response that arrives thru the same channel to several different clients at the same time going to be mixed?

Regarding the server - the SingleCall setting insure that separate object is going to be created on server side for each client request. Does separate channel also created automatically for each client connection on the server side? or I have to manage that?

MadHatter
April 10th, 2007, 03:07 PM
channels are created independently of the objects for a reason. because .NET takes care of what uses what.

nothing will ever get stepped on / stumbled over. remoting isn't some simple tcp connection where one object might use another objects info off the TCP stack to initialize objects randomly. each server object is created on the client side through a transparent proxy and can only be unwrapped by that proxy.

single call objects are like disposable objects. they are used once and then destroyed on the client's end.

a_k_
April 10th, 2007, 06:40 PM
Thank you for your help.
It is SO different from the classic TCP client/server I used before...
I'm just double-checking if it is OK to create and register just ONE channel on the client side and share it for all the concurrent client calls?
Is the following code correct:

if (!_RemotingClientConfigDone)
{
TcpChannel channel = new TcpChannel();
ChannelServices.RegisterChannel(channel, false);
_RemotingClientConfigDone = true;
}
obj = Activator.GetObject(
remotingObjectType,
objectUrl);

where _RemotingClientConfigDone is defined as a static variable in the class:

static bool _RemotingClientConfigDone = false;

Thank you,
a_k_