help in IceStorm

marikamarika Member Marika RodegherOrganization: University of VeronaProject: Client-Server
hi!
I tried to write an application using IceStorm: I have 1 subscriber, 1 publisher and a program which act as subscriber for the second one and as publisher for the first one. When I try to close this last program with CTRL+C it does nothing, so for closing it I have to do CRTL+Z but in this case in the shell where I write this comand:
" icebox --Ice.Config=config.icebox "
it doesn't unsubscribe the application.. it still flushing the object.
How can I resolve this problem?
Thank you,
Sincerely Marika

Comments

  • matthewmatthew NL, CanadaMember Matthew NewhookOrganization: ZeroC, Inc.Project: Internet Communications Engine ✭✭✭
    What application precisely are you trying to terminate with ^C? Did you try the clock demo? If so, did this work as you expect?
  • marikamarika Member Marika RodegherOrganization: University of VeronaProject: Client-Server
    I modified the clock demo adapting it with my scene, so I create a publisher "BodyNetwork" which asks an integer value and sends the message to the subscriber called "Gateway" that is subscribed to the same topic of the publisher. Then the "Gateway" is taken care to send to the subscriber "Hospital" a message of alarm. So there is another topic name between "Gateway" and "Hospital".
    For doing this I thought to create "Gateway" both as publisher and subscriber: after activating the adapter (so it is still subscriber) I put the code for the publisher for sending an alarm message to the "Hospital" but then I can't call "waitForShutDown".
    When I want to terminate the application, the publisher "BodyNetwork" ends
    correctly because it ends to ask the values; the subscriber "Hospital" ends with ^C and it will unsubscribe from IceStorm; but for terminating the publisher/subcriber "Gateway" I must do ^Z, but in this case it only stops the application and doesn't kill it, so it will not unsubscribe from IceStorm.
    If necessary I put my source code.
    Thanks,
    Marika
  • matthewmatthew NL, CanadaMember Matthew NewhookOrganization: ZeroC, Inc.Project: Internet Communications Engine ✭✭✭
    If you are using Ice::Application the default behaviour is to destroy the communicator upon reception of a SIGINT. In this case the next message you sent to IceStorm will result in a CommunicatorDestroyedException. You can then key on this to determine that the app has been interrupted.

    Another approach is to create a thread which does the message publishing, and call waitForShutdown() in the main thread. In this case call Ice::Application::shutdownOnInterrupt(). Once waitForShutdown() has returned then you can terminate the thread and exit the application.
  • marikamarika Member Marika RodegherOrganization: University of VeronaProject: Client-Server
    ok, I resolved the problem!
    Thank you! :)
    Bye Marika
Sign In or Register to comment.