Home Help Center

Shut down the Icepatch2 Server programmatically

EwgenijkkgEwgenijkkg Member Ewgenij SokolovskiOrganization: RWTHProject: Rove ✭✭
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

Comments

  • matthewmatthew NL, CanadaMember Matthew NewhookOrganization: ZeroC, Inc.Project: Internet Communications Engine ✭✭✭
    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:
    IcePatch2::AdminPrx admin = IcePatch2::Admin::checkedCast(communicator->stringToProxy("MyIcePatch/admin:tcp -p 9999 -h 192.168.1.2");
    admin->shutdown();
    
  • EwgenijkkgEwgenijkkg Member Ewgenij SokolovskiOrganization: RWTHProject: Rove ✭✭
    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
  • dwaynedwayne St. John's, NewfoundlandMember Dwayne BooneOrganization: ZeroC, Inc.Project: Internet Communications Engine
    Yes, to use the Admin interface you will need to include IcePatch2/FileServer.h and then link your application with the IcePatch2 library.
  • EwgenijkkgEwgenijkkg Member Ewgenij SokolovskiOrganization: RWTHProject: Rove ✭✭
    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.
  • matthewmatthew NL, CanadaMember Matthew NewhookOrganization: ZeroC, Inc.Project: Internet Communications Engine ✭✭✭
    It should be IcePatch2::AdminPrx::uncheckedCast not Admin::uncheckedCast.
  • EwgenijkkgEwgenijkkg Member Ewgenij SokolovskiOrganization: RWTHProject: Rove ✭✭
    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
  • matthewmatthew NL, CanadaMember Matthew NewhookOrganization: ZeroC, Inc.Project: Internet Communications Engine ✭✭✭
    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.
Sign In or Register to comment.