Events over remoting.  
Author Message
Tamim Sadikali





PostPosted: .NET Remoting and Runtime Serialization, Events over remoting. Top

Hi,

my client subscribes to an event on my remoting server, and at the point at which suscribers are to be notified I get:

'A connection failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond'

Any ideas This one is truly killing me.

Thanks,

Tamim.




.NET Development24  
 
 
schveiguy





PostPosted: .NET Remoting and Runtime Serialization, Events over remoting. Top

The guy who wrote the book on remoting has a FAQ at http://www.thinktecture.com/Resources/RemotingFAQ/RemotingUseCases.html

This clearly states, "don't use events with remoting" I think it has to do with the fact that you are turning your client into a server, with the remoting server trying to activate the object on the client. It could be because of a lot of reasons.

In a remoting application I built, I handle events sort of manually, through polling. What I do is create a separate thread to receive events, and then I call on a remote object in the server to wait 2 seconds to see if an event arrives. If an event arrives, it returns immediately, otherwise it times out and checks if the application is ending. Not sure if this helps with your problem, but it works for me :)

-Steve


 
 
Tamim Sadikali





PostPosted: .NET Remoting and Runtime Serialization, Events over remoting. Top

Hi Steve,

I eventually resolved my issue!

You're right - implementing events over remoting does indeed turn your client into a server, and the referenced article does indeed caution against this approach, but it's do-able, workable and neat. And there's just as many articles showing how to do it:

http://www.codeproject.com/csharp/RemotingAndEvents.asp

http://www.bearcanyon.com/dotnet/#fireserverevents

My problem in the end was that my client-side sponsors - which themselves are remoting objects - weren't living for as long as the remoting objects, whose lifetime they were meant to be managing! Sounds like a really stupid mistake, but here's the thing - implementing events over remoting can easily get tricky, (and is a nightmare to sort out when trouble starts), so you've really got to know what you're doing.

I personally would say it's a better solution than your 'polling' workaround, and whilst I would certainly not advise tinkering with something that works, you might want to consider the alternative if you need to implement the same scenario again.

Many thanks for commenting on my issue,

Tamim.