Solved

Determining Failure on .NET Remoting question

Posted on 2003-10-26
11
597 Views
Last Modified: 2012-06-27
I have a object that is remotely hosted on a server.  I have multiple questions:

1.  If a call to the server (via method call on the remoting object) makes the server hang, the client hangs, is there a way to set a timeout on a remoting call, or will I have to watch it in a seperate thread?

2.  If a call to the server (via method call on the remoting object) throws an exception, is there a way to check whether this is due to the client not having an internet connection or the server being down?  Basically, is there an easy way to determine if the client has an interent connection up and running?  
0
Comment
Question by:jjacksn
  • 7
  • 4
11 Comments
 
LVL 10

Expert Comment

by:ptmcomp
ID: 9625389
I think only a client can determinate when the server hangs.
Are you using TCP remoting?? This "hangers" are caused by an implementation failure. Use HTTP remoting with binary formatter and the problems should be gone...
0
 
LVL 5

Author Comment

by:jjacksn
ID: 9629094
The hangs are due to actual bugs in the server code.

I am using HTTP remoting with a binary formatter.  

Is there any easy way to determine if a connection exists?
0
 
LVL 10

Accepted Solution

by:
ptmcomp earned 250 total points
ID: 9629523
>The hangs are due to actual bugs in the server code.
Due bugs in your or "Microsoft's .net framework" code? (We had such problems and thought to have it solved with the httpChannel...)

>Basically, is there an easy way to determine if the client has an interent connection up and running?
Yes, use any other service to check if the internet is available (e.g. DNS or http request on a very stable website. You can also use ping, or any other protocol.)

>is there a way to set a timeout on a remoting call?
As far I know: no. You can use a delegate with BeginInvoke / EndInvoke to call the method asynchronous.

>If a call to the server (via method call on the remoting object) throws an exception, is there a way to check whether this is due to the client not having an internet connection or the server being down?
Almost not possible :o(
0
 
LVL 5

Author Comment

by:jjacksn
ID: 9658933
ptm,

Thanks,

I'm a little confused how the workflow should go for determining server hangs.  I should call the method in a seperate thread, then have the thread that is not calling the procedue loop until the first thread is done or times out?
0
 
LVL 10

Expert Comment

by:ptmcomp
ID: 9812869
I had some similar problems today and I traced the network traffic. What kind of remoting objects did you use (client activated, singelton, single call)?
It seems that under certain circumstances the endpoint given back to the client which should be the server's ip is rubbish as 127.0.0.1 and then the client tries to connect to this endpoint what results in a stupid loop-back. The error message is that the remote client is not reachable but in fact they were communicating with each other to contruct the object on the server but then the server gave back a wrong object-endpoint/url.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 5

Author Comment

by:jjacksn
ID: 9812913
We are using singletons.  

This ip is coming back as 127.0.0.1?  When is under what conditions is this happening?  When my network is disconnected, the timeout is quick.  However, when I turn the server off, and the client has an internet connection, it takes a long time to fail.  

When the client isn't sure if it has a valid internet connection (bad peer to peer network or something) it takes extremely long for the timeout to happen.
0
 
LVL 10

Expert Comment

by:ptmcomp
ID: 9813311
I think you should also try to make a SingleCall lightweight remoting facade for your singletons. You can still access standard singleton objects behind that facade. SingleCall doesn't use this endpoint stuff and might be not cause those errors. That's may be why Ingo Rammer is also telling to use SingleCall - but he's not telling why. May be he must not say that Microsoft did very bad work in implementing this Remoting endpoint stuff...
0
 
LVL 10

Expert Comment

by:ptmcomp
ID: 9813336
Another thing: In usual remoting calls with CAO (client activated objects) there is no new TCP connection opened and it's not closed in the end for both: TCP and HTTP remoting. I think they assume that an opened connection will stay forever open till explicitly closed. (WinInet has also problems with connections that are closed by timeout or cause of network problems.) It's like you call someone with your cellphone while driving a car and just trying to continue your conversation when the line is cut...
0
 
LVL 10

Expert Comment

by:ptmcomp
ID: 9813487
There are other channels available which say that they are more reliable:

http://www.genuinechannels.com/Content.aspx?id=17&type=1
http://www.ingorammer.com/Software/OpenSource.html
0
 
LVL 10

Expert Comment

by:ptmcomp
ID: 9830098
0
 
LVL 5

Author Comment

by:jjacksn
ID: 9843768
The root of the problem, is that the timeout just takes way to long when the server is unreachable.  Isn't there some way to specify the timeout delay?
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This video discusses moving either the default database or any database to a new volume.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now