Solved

Determining Failure on .NET Remoting question

Posted on 2003-10-26
11
615 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
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
 
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

813 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

17 Experts available now in Live!

Get 1:1 Help Now