Using .NET Remoting with multiple users

P

Paul Steele

I am developing a client/server app and would like to use .NET Remoting to
allow the server to communicate with clients. I've been able to test this
with a single client, but .NET Remoting seems to make it very difficult to
establish connections with multiple users. This is the code I use for
connecting a single user:

IDictionary props = new Hashtable();
props["port"] = "0";
props["name"] = RemoteMachineName;
TcpChannel channel = new TcpChannel(props, null, null);
ChannelServices.RegisterChannel(channel);
RemotingConfiguration.RegisterWellKnownClientType(typeof(RemoteObject),
"tcp://" + RemoteMachineName +
":9999/ExamProctor/RemoteObject");

This works fine and allows be to connect to the remote object as expected.
When I try to connect another user, the call to RegisterWellKnownClientType
fails indicating that the remote object has already been redirected. Is
there any way to use .NET Remoting to establish remote objects on multiple
clients?
 
G

Guest

There are two ways to set this up:

RemotingConfiguration.RegisterWellKnownClientType(typeof(RemoteObject),
"tcp://" + RemoteMachineName +
":9999/ExamProctor/RemoteObject", WellKnownObjectMode.SingleCall);

RemotingConfiguration.RegisterWellKnownClientType(typeof(RemoteObject),
"tcp://" + RemoteMachineName +
":9999/ExamProctor/RemoteObject", WellKnownObjectMode.Singleton);


By default, it is set to Singleton. This is not a bad thing, in some
instances, but is likely the source, or at least part of the source, of your
problem. Check out:

http://www.devx.com/dotnet/Article/6965/


--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 
P

Paul Steele

Cowboy (Gregory A. Beamer) - MVP said:
There are two ways to set this up:

RemotingConfiguration.RegisterWellKnownClientType(typeof(RemoteObject),
"tcp://" + RemoteMachineName +
":9999/ExamProctor/RemoteObject", WellKnownObjectMode.SingleCall);

RemotingConfiguration.RegisterWellKnownClientType(typeof(RemoteObject),
"tcp://" + RemoteMachineName +
":9999/ExamProctor/RemoteObject", WellKnownObjectMode.Singleton);

Do you mean "RegisterWellKnownServiceType"? No form of
"RegisterWellKNownClientType" take three arguments.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top