all groups > dotnet remoting > june 2005 >
You're in the

dotnet remoting

group:

Consuming A Remoting Server


Consuming A Remoting Server jabailo NO[at]SPAM texeme.com
6/24/2005 2:31:54 PM
dotnet remoting:

In my code, I consume a remoting server with:

RemotingConfiguration.Configure("ChatClient.exe.config");

// Create a proxy to the remote object.
ChatCenter chatcenter = new ChatCenter();

// Create a remotely delegatable object
MyCallbackClass callback = new MyCallbackClass (_alias) ;


In another examle I see:

HttpChannel channel = new HttpChannel();
ChannelServices.RegisterChannel(channel);

ICustomerManager mgr = (ICustomerManager) Activator.GetObject(
typeof(ICustomerManager),
"http://localhost:1234/CustomerManager.soap");

Console.WriteLine("Client.Main(): Reference to CustomerManager acquired");

Customer cust = mgr.GetCustomer(4711);

Re: Consuming A Remoting Server jabailo NO[at]SPAM texeme.com
6/24/2005 6:14:46 PM
[quoted text, click to view]

Thanks Peter. I am using the config file as well -- it seems far more
flexible so I agree -- I am just wondering if the code method provides any
additional configurability such as reconnect/retry attempts, or if I would
have to write that code myself regardless of what method I use...


[quoted text, click to view]

--
Texeme Textcasting Technology
Re: Consuming A Remoting Server peter
6/24/2005 11:07:15 PM
Hi John,

The first allows you to use config files, and the 'new' operator. The
second will work for interfaces and abstract base classes (neither of
which can be instantiated using new).

I always use the first method unless there really is no alternative. It
allows me to use text files for configuration, which is a huge advantage
(IMHO)

Peter

[quoted text, click to view]
Re: Consuming A Remoting Server peter
6/25/2005 12:00:00 AM
[quoted text, click to view]

Hi John,

I think you've had a far better answer to your connection(less) question
than I could ever give you, so I'll concentrate on this one - which
seems to be at the root of your problem.

I'm not sure I entirely understand what you're getting at, but let's try
for an answer anyway.

If you try to connect to a server that is not responding, you will get
an Exception back saying that the server is, "Actively refusing
connections". You could trap that, I suppose. However, I'm surprised
that you have such an unreliable connection. It is possible, I guess,
that a service could fail to start after a server reboot, for example -
but where I work, at least, we always check for that sort of thing after
every reboot.

If you were really concerned about outages in mission-critical
situations you would presumably have failover strategies and the like
such that a request would be diverted to a different server. Of course
if your servers are not exact replicas of each other, then you might
lose some state. I always make sure that my applications check the
consistency of their internal states at every significant move - and
send messages back to users about how to recover if there's a problem.
But mainly I try very hard to keep things stateless. I only use CAOs
when I absolutely must - which is once, so far.

Why do you consider it a problem worth worrying about, John? Do you
have a specific scenario in mind?

Cheers

Re: Consuming A Remoting Server jabailo NO[at]SPAM texeme.com
6/25/2005 11:43:57 AM

Peter,

THat is good information so far.

This is more of a 'workgroup' multiuser type application.

It's not real-time, but as far the user experience goes, I want them to be
able to connect to the remoting server with a high degree of reliability.

And, if say, our network ( which is flimsy ) caused a 'burp' while something
was being sent or received, there would be a way to recover in the client.


[quoted text, click to view]

--
Texeme Textcasting Technology
Re: Consuming A Remoting Server peter
6/25/2005 8:22:50 PM
[quoted text, click to view]

OK. I'm on unfamiliar ground here, so treat what I say with some
suspicion - and hope that someone with more knowledge comes up with some
better suggestions.

The first thing to do is to check whether you can trap the Exception
thrown when the server fails to respond. Make sure your client code is
in a try/catch block, set a debugger breakpoint on the first call to the
remote object (not the 'new' operation as that just calls the proxy),
stop the server and then try to make the remote call, which will
obviously fail because the server is not listening. Hopefully you'll
end up on the catch part of the try/catch block.

Try that first. If the Exception can be caught, and I'd be surprised if
it couldn't, the next step might be to find out exactly what type(s) of
Exception(s) get generated so that it/they can be caught specifically
and not just with the generic Exception type.

Then you can do whatever your program requires - e.g. show an error
message and ask the user to try again, or resend, or whatever.

HTH

AddThis Social Bookmark Button