HighTechTalks DotNet Forums  

how to implement pinging

Dotnet Framework (Remoting) microsoft.public.dotnet.framework.remoting


Discuss how to implement pinging in the Dotnet Framework (Remoting) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Robert Ludig
 
Posts: n/a

Default how to implement pinging - 04-11-2007 , 03:46 AM






I have a long running remoting client that every once in a while calls
a method on a remoting server. The client constantly displays the
connection status. How can the remoting client find out that the
remoting server has become unavailable right after it happend?
Does .NET Remoting have any built in ping-like functionality? What is
the best practice in .NET Remoting for (keep) alive probing?


Reply With Quote
  #2  
Old   
Spam Catcher
 
Posts: n/a

Default Re: how to implement pinging - 04-11-2007 , 02:59 PM






"Robert Ludig" <schwertfischtrombose (AT) gmx (DOT) de> wrote in
news:1176277585.267836.321700 (AT) n59g2000hsh (DOT) googlegroups.com:

Quote:
I have a long running remoting client that every once in a while calls
a method on a remoting server. The client constantly displays the
connection status. How can the remoting client find out that the
remoting server has become unavailable right after it happend?
Does .NET Remoting have any built in ping-like functionality? What is
the best practice in .NET Remoting for (keep) alive probing?
Unfortunately no - not in the default channels.

You'll need something like Geniune Channels.

However, with the built in channels, just create a timer and fire off a
function call to a dummy function on the server. If the function times out
(or errors), you know your connection is fubar.


Reply With Quote
  #3  
Old   
Robert Ludig
 
Posts: n/a

Default Re: how to implement pinging - 04-12-2007 , 01:56 AM



On Apr 11, 8:59 pm, Spam Catcher <spamhoney... (AT) rogers (DOT) com> wrote:
Quote:
"Robert Ludig" <schwertfischtromb... (AT) gmx (DOT) de> wrote innews:1176277585.267836.321700 (AT) n59g2000hsh (DOT) googlegroups.com:

I have a long running remoting client that every once in a while calls
a method on a remoting server. The client constantly displays the
connection status. How can the remoting client find out that the
remoting server has become unavailable right after it happend?
Does .NET Remoting have any built in ping-like functionality? What is
the best practice in .NET Remoting for (keep) alive probing?

Unfortunately no - not in the default channels.

You'll need something like Geniune Channels.

However, with the built in channels, just create a timer and fire off a
function call to a dummy function on the server. If the function times out
(or errors), you know your connection is fubar.
There is only one problem with you suggested approach:
How do I control the timeout? When I call the remote server that is
not reachable the application hangs for a long time. (I haven't
figured out yet where that timespan comes from.) Not only do I want my
app to not hang but also I would like to specify my own timeout
timespan. I could of course call the ping in a dedicated thread and
kill that thread if it does not return for a specified timespan but
one thread for each ping and each remoting client? That'd be a hell of
a lot threads.




Reply With Quote
  #4  
Old   
Spam Catcher
 
Posts: n/a

Default Re: how to implement pinging - 04-12-2007 , 02:59 PM



"Robert Ludig" <schwertfischtrombose (AT) gmx (DOT) de> wrote in
news:1176357364.698091.170770 (AT) y5g2000hsa (DOT) googlegroups.com:

Quote:
On Apr 11, 8:59 pm, Spam Catcher <spamhoney... (AT) rogers (DOT) com> wrote:
"Robert Ludig" <schwertfischtromb... (AT) gmx (DOT) de> wrote
innews:1176277585.267836.321700 (AT) n59g2000hsh (DOT) googlegroups.com:

I have a long running remoting client that every once in a while
calls a method on a remoting server. The client constantly displays
the connection status. How can the remoting client find out that
the remoting server has become unavailable right after it happend?
Does .NET Remoting have any built in ping-like functionality? What
is the best practice in .NET Remoting for (keep) alive probing?

Unfortunately no - not in the default channels.

You'll need something like Geniune Channels.

However, with the built in channels, just create a timer and fire off
a function call to a dummy function on the server. If the function
times out (or errors), you know your connection is fubar.

There is only one problem with you suggested approach:
How do I control the timeout? When I call the remote server that is
not reachable the application hangs for a long time.
Run the ping in a separate thread so it does not lock up your GUI
thread.

Quote:
(I haven't
figured out yet where that timespan comes from.) Not only do I want my
app to not hang but also I would like to specify my own timeout
timespan.
I think you can specify the timeout on certain .NET channels during the
setup. Check the configuration parameters ...


Quote:
I could of course call the ping in a dedicated thread and
kill that thread if it does not return for a specified timespan but
one thread for each ping and each remoting client? That'd be a hell of
a lot threads.
You don't need to create multiple ping threads. Just have each client
ping the server with 1 thread (and reuse the thread). The server
responds to the ping with some dummy data.


Reply With Quote
  #5  
Old   
Robert Ludig
 
Posts: n/a

Default Re: how to implement pinging - 04-13-2007 , 02:19 AM



On Apr 12, 8:59 pm, Spam Catcher <spamhoney... (AT) rogers (DOT) com> wrote:
Quote:
"Robert Ludig" <schwertfischtromb... (AT) gmx (DOT) de> wrote innews:1176357364.698091.170770 (AT) y5g2000hsa (DOT) googlegroups.com:





On Apr 11, 8:59 pm, Spam Catcher <spamhoney... (AT) rogers (DOT) com> wrote:
"Robert Ludig" <schwertfischtromb... (AT) gmx (DOT) de> wrote
innews:1176277585.267836.321700 (AT) n59g2000hsh (DOT) googlegroups.com:

I have a long running remoting client that every once in a while
calls a method on a remoting server. The client constantly displays
the connection status. How can the remoting client find out that
the remoting server has become unavailable right after it happend?
Does .NET Remoting have any built in ping-like functionality? What
is the best practice in .NET Remoting for (keep) alive probing?

Unfortunately no - not in the default channels.

You'll need something like Geniune Channels.

However, with the built in channels, just create a timer and fire off
a function call to a dummy function on the server. If the function
times out (or errors), you know your connection is fubar.

There is only one problem with you suggested approach:
How do I control the timeout? When I call the remote server that is
not reachable the application hangs for a long time.

Run the ping in a separate thread so it does not lock up your GUI
thread.

(I haven't
figured out yet where that timespan comes from.) Not only do I want my
app to not hang but also I would like to specify my own timeout
timespan.

I think you can specify the timeout on certain .NET channels during the
setup. Check the configuration parameters ...
Yes I have tried that. But those timouts do not seem have any effect
in case the server is not reachable.
This is how I did it:

Hashtable properties = new Hashtable();
properties.Add("port", 0); // let system pick an open port
properties.Add("timeout", 10000); // 10 second timeout...
IClientChannelSinkProvider provider = new
BinaryClientFormatterSinkProvider();
provider.Next = new CompressedClientChannelSinkProvider();
HttpChannel channel = new HttpChannel(properties, provider, null);
channel.WantsToListen = false;
ChannelServices.RegisterChannel(channel);

Anything wrong with that?



Quote:
I could of course call the ping in a dedicated thread and
kill that thread if it does not return for a specified timespan but
one thread for each ping and each remoting client? That'd be a hell of
a lot threads.

You don't need to create multiple ping threads. Just have each client
ping the server with 1 thread (and reuse the thread). The server
responds to the ping with some dummy data.- Hide quoted text -

- Show quoted text -



Reply With Quote
  #6  
Old   
Phil Wilson
 
Posts: n/a

Default Re: how to implement pinging - 04-19-2007 , 11:30 PM



More recent OS versions have the WMI Win32_PingStatus class that you can
call using the Management classes.

There are some C# implementations out there, like this one:

http://www.codeproject.com/dotnet/CSharpPing.asp

--
Phil Wilson
[Microsoft MVP-Windows Installer]

"Spam Catcher" <spamhoneypot (AT) rogers (DOT) com> wrote

Quote:
"Robert Ludig" <schwertfischtrombose (AT) gmx (DOT) de> wrote in
news:1176277585.267836.321700 (AT) n59g2000hsh (DOT) googlegroups.com:

I have a long running remoting client that every once in a while calls
a method on a remoting server. The client constantly displays the
connection status. How can the remoting client find out that the
remoting server has become unavailable right after it happend?
Does .NET Remoting have any built in ping-like functionality? What is
the best practice in .NET Remoting for (keep) alive probing?

Unfortunately no - not in the default channels.

You'll need something like Geniune Channels.

However, with the built in channels, just create a timer and fire off a
function call to a dummy function on the server. If the function times out
(or errors), you know your connection is fubar.



Reply With Quote
  #7  
Old   
Robert Ludig
 
Posts: n/a

Default Re: how to implement pinging - 05-11-2007 , 06:03 AM



This not an option because it doen't ping the actual remoting objects.
There is no way to guarantee that the remote object is available.
While the host (aka the remote machine) might be pingable that doesn't
mean that the remoting server on a specifc port and remoting uri is
available on that machine.

Also if you wanted pinging the way you described there is no need to
use wmi. You can simply use the ping class of the .NET Framework:

http://msdn2.microsoft.com/en-us/lib...tion.ping.aspx

On 20 Apr., 05:30, "Phil Wilson" <pdjwil... (AT) nospam (DOT) cox.net> wrote:
Quote:
More recent OS versions have the WMI Win32_PingStatus class that you can
call using the Management classes.

There are some C# implementations out there, like this one:

http://www.codeproject.com/dotnet/CSharpPing.asp

--
Phil Wilson
[Microsoft MVP-Windows Installer]

"Spam Catcher" <spamhoney... (AT) rogers (DOT) com> wrote in message

news:Xns990F9867EBC4Cusenethoneypotrogers (AT) 127 (DOT) 0.0.1...



"Robert Ludig" <schwertfischtromb... (AT) gmx (DOT) de> wrote in
news:1176277585.267836.321700 (AT) n59g2000hsh (DOT) googlegroups.com:

I have a long running remoting client that every once in a while calls
a method on a remoting server. The client constantly displays the
connection status. How can the remoting client find out that the
remoting server has become unavailable right after it happend?
Does .NET Remoting have any built in ping-like functionality? What is
the best practice in .NET Remoting for (keep) alive probing?

Unfortunately no - not in the default channels.

You'll need something like Geniune Channels.

However, with the built in channels, just create a timer and fire off a
function call to a dummy function on the server. If the function times out
(or errors), you know your connection is fubar.- Zitierten Text ausblenden -

- Zitierten Text anzeigen -



Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.