Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 11-07-2005
OrNot OrNot is offline
Registered User
 
Name: Bin.Li
Organization: GE Healthcare
Project: Enterprise solution
 
Join Date: Jun 2005
Location: Shanghai
Posts: 157
Send a message via MSN to OrNot
-->
Question about ConnectionLost

hi,
In bidir circumstance, I create a thread in client to reigster the callbacks periodically to the server in case that the server suddenly breaks down but restart again. The client , actually a service, is not necessary to restart and can keep working with the server.
Are there any better solutions so that I just need retry to register the callbacks only when I detect the connection lost or connection closure. Try-catch?

Best Regareds
OrNot
__________________
Looking for the nails with my favorite hammer, ICE.
-------------------------------------------
Huo.Fei
GE Healthcare
Bin.Li@ge.com
--------------------------------------------
Reply With Quote
  #2 (permalink)  
Old 11-07-2005
matthew's Avatar
matthew matthew is offline
ZeroC Staff
 
Name: Matthew Newhook
Organization: ZeroC, Inc.
Project: Internet Communications Engine
 
Join Date: Feb 2003
Location: NL, Canada
Posts: 1,060
You could have the server ping the client at regular intervals. If no ping arrives, then the client must re-register.
Reply With Quote
  #3 (permalink)  
Old 11-08-2005
OrNot OrNot is offline
Registered User
 
Name: Bin.Li
Organization: GE Healthcare
Project: Enterprise solution
 
Join Date: Jun 2005
Location: Shanghai
Posts: 157
Send a message via MSN to OrNot
-->
hi,Matthew,
Do you actually mean let client ping server in my scenario?
So far the ping solution , I think it is a "positive method to detect the server status as what I now adopt to register callbacks periodically . I am afraid these frequent pings will result in some overloads to server.
Can I have some "defensive" methods to register the callback such as :

try
{
.......
}
catch(Ice::ConnectionLostException)
{
registerCallbacks();
}


But I am doubting about this strategy because it seems difficult to arrange the try-catch especially with the thread-pool model.


Hope getting your further ideas.
Thanks

OrNot
__________________
Looking for the nails with my favorite hammer, ICE.
-------------------------------------------
Huo.Fei
GE Healthcare
Bin.Li@ge.com
--------------------------------------------
Reply With Quote
  #4 (permalink)  
Old 11-08-2005
matthew's Avatar
matthew matthew is offline
ZeroC Staff
 
Name: Matthew Newhook
Organization: ZeroC, Inc.
Project: Internet Communications Engine
 
Join Date: Feb 2003
Location: NL, Canada
Posts: 1,060
Without knowing your architecture in more detail ts very hard to give very good advice. Why do you think that using a thread pool is makes it more difficult to reestablish the connection?
Reply With Quote
  #5 (permalink)  
Old 11-08-2005
OrNot OrNot is offline
Registered User
 
Name: Bin.Li
Organization: GE Healthcare
Project: Enterprise solution
 
Join Date: Jun 2005
Location: Shanghai
Posts: 157
Send a message via MSN to OrNot
-->
hi, Mathrew,
I am looking for a method to know the server's status ,especially the server's closure.

1) If the client has GUI, I hope the client can know the server's down even the client are not sending requests at the moments. For example, the client can pup up a massgebox to give the server down message.
2) if the client is a service, I also hope the client can know the server's down and start a thread to try to reestiblish the connection until server is re-up.

I notice that Ice can trace this , but I have no ideas how to catch this in my client program especially in thread pool mode.

Thank you very much.

OrNOt
__________________
Looking for the nails with my favorite hammer, ICE.
-------------------------------------------
Huo.Fei
GE Healthcare
Bin.Li@ge.com
--------------------------------------------
Reply With Quote
  #6 (permalink)  
Old 11-08-2005
marc's Avatar
marc marc is offline
ZeroC Staff
 
Name: Marc Laukien
Organization: ZeroC, Inc.
Project: The Internet Communications Engine
 
Join Date: Feb 2003
Location: Florida
Posts: 1,781
As Matthew wrote, you must write a monitor thread (or something similar) that regularly pings the server to find out if it is still alive.

There is no other way to reliably detect if a server is still alive. In some cases, the TCP/IP stack can detect if a server goes down (that's when you see the trace message), but in many other cases, it can't. For example, if you run the client and server over DSL and cut the phone line, then you won't get this log message until the client actively tries to send something to the server.
Reply With Quote
  #7 (permalink)  
Old 11-08-2005
OrNot OrNot is offline
Registered User
 
Name: Bin.Li
Organization: GE Healthcare
Project: Enterprise solution
 
Join Date: Jun 2005
Location: Shanghai
Posts: 157
Send a message via MSN to OrNot
-->
hi,Marc,
Thanks for your clear answer.
But, if anyway, I want to know if the server is still alive as ice trace does even it is not very realiable , do I have opporunity to catch that signal from my program as ice trace does with the current version 2.1.2?

Cheers
OrNot
__________________
Looking for the nails with my favorite hammer, ICE.
-------------------------------------------
Huo.Fei
GE Healthcare
Bin.Li@ge.com
--------------------------------------------
Reply With Quote
  #8 (permalink)  
Old 11-09-2005
marc's Avatar
marc marc is offline
ZeroC Staff
 
Name: Marc Laukien
Organization: ZeroC, Inc.
Project: The Internet Communications Engine
 
Join Date: Feb 2003
Location: Florida
Posts: 1,781
No, you cannot. You can only catch the exception if you invoke an operation.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT -4. The time now is 11:25 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
(c) 2008 ZeroC, Inc.