Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 06-14-2007
Ewgenijkkg Ewgenijkkg is offline
Registered User
 
Name: Ewgenij Sokolovski
Organization: RWTH
Project: Rove
 
Join Date: Mar 2007
Posts: 36
Shut down the Icepatch2 Server programmatically

Hello. I use Ice-3.1.1 now and IcePatch2 which is included in this distribution. I read in the manual that I can shut down the IcePatch2-Server programmatically if I passed the IcePatch2.Admin.Endpoints endpoint at its start. I read on the page 1465 of the manual:

If this property is not set, the only way to shut down the server is to kill it
somehow, such as by interrupting the server from the command line. If this
property is set, the server offers an additional interface with a shutdown operation,
allowing clients to remotely stop the server. Typically, you would set
this property to a port that is not accessible to potentially hostile clients.


But how can I access this interface and call the shut down function? Is there a simple way? Or do I have to look into your code in order to find out the name of the admin-servant, its identity and so on to create an appropriate proxy in the client and call the shut down?

Greetings
Ewgenij
Reply With Quote
  #2 (permalink)  
Old 06-14-2007
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,088
The endpoints are determined by the endpoints set via IcePatch2.Admin.Endpoints. The identity of the proxy is the IcePatch2 instancename/admin. The type of object is IcePatch2::Admin.

For example, if you have configured IcePatch2 as follows:

IcePatch2.Admin.Endpoints=tcp -p 9999 -h 192.168.1.2
IcePatch2.InstanceName=MyIcePatch

then you can shutdown an instance of the IcePatch2 server as follows:

Code:
IcePatch2::AdminPrx admin = IcePatch2::Admin::checkedCast(communicator->stringToProxy("MyIcePatch/admin:tcp -p 9999 -h 192.168.1.2");
admin->shutdown();
Reply With Quote
  #3 (permalink)  
Old 06-14-2007
Ewgenijkkg Ewgenijkkg is offline
Registered User
 
Name: Ewgenij Sokolovski
Organization: RWTH
Project: Rove
 
Join Date: Mar 2007
Posts: 36
Hello. But to initialize IcePatch2::AdminPrx I have to include some source file where it is defined. Which one is that? I found with grep that class Admin is defined in FileServer.h. Is it the right way?

Greetings
Ewgenij
Reply With Quote
  #4 (permalink)  
Old 06-14-2007
dwayne's Avatar
dwayne dwayne is offline
ZeroC Staff
 
Name: Dwayne Boone
Organization: ZeroC, Inc.
Project: Internet Communications Engine
 
Join Date: Jan 2005
Location: St. John's, Newfoundland
Posts: 215
Yes, to use the Admin interface you will need to include IcePatch2/FileServer.h and then link your application with the IcePatch2 library.
Reply With Quote
  #5 (permalink)  
Old 06-14-2007
Ewgenijkkg Ewgenijkkg is offline
Registered User
 
Name: Ewgenij Sokolovski
Organization: RWTH
Project: Rove
 
Join Date: Mar 2007
Posts: 36
Done that, but it doesn't come to linking. The compiler says:

error: 'checkedCast' is not a member of 'IcePatch2::Admin'

so I need to include somethin else.
Reply With Quote
  #6 (permalink)  
Old 06-14-2007
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,088
It should be IcePatch2::AdminPrx::uncheckedCast not Admin::uncheckedCast.
Reply With Quote
  #7 (permalink)  
Old 06-14-2007
Ewgenijkkg Ewgenijkkg is offline
Registered User
 
Name: Ewgenij Sokolovski
Organization: RWTH
Project: Rove
 
Join Date: Mar 2007
Posts: 36
Hello, thank you, guys, for helping me. It works now! Is the usage of this Admin port for closing of IcePatch described somewhere in the manual? I mean with all this includes and linking stuff. I couldn't find it there.

Greetings
Ewgenij
Reply With Quote
  #8 (permalink)  
Old 06-14-2007
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,088
Calling on the IcePatch2 server is no different from calling on any other server. You need the slice and you need to know the address & identity of the object you are calling. The include files and library files that you are using are prebuilt and distributed with Ice, however, there is no requirement that you use these. You could compile the slice yourself. All of this information is covered in the various language mapping chapters of the Ice manual.

I think that the only piece of missing information is the identity of the IcePatch2 service admin object.
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
How add a new Property to the IcePatch2 Server? Ewgenijkkg Help Center 4 04-19-2007 01:05 PM
IcePatch2-Server adding new functionality Ewgenijkkg Help Center 8 04-11-2007 10:35 AM
how to shut down a node? russule Help Center 2 01-08-2007 05:13 AM
Using Properties Programmatically Oleh Babyak Help Center 1 11-22-2006 12:33 PM
how to create a icepatch2 Server using python? jeylee Help Center 3 03-11-2005 05:05 AM


All times are GMT -4. The time now is 12:33 AM.


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