Creating interrupt handler to remove pipe

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • machshev
    New Member
    • Jan 2009
    • 1

    #1

    Creating interrupt handler to remove pipe

    Hello,

    I'm using a client server example which can be found at:
    Client Server example with PIPES ~ Coding Freak

    I was hoping if someone could help me understand how to make it so that the pipe PUBLIC is automatically removed when the server gets killed through Ctrl-C. I believe this involves using an interrupt handler but not sure how to do this.

    The client is described first (in the article) followed by the server. When ready to launch, I first start the server in the background by using ./server & followed by running the client. The CMD prompt allows the user to type anything and it goes through the server. As of now, when Ctrl-C is used it kills the client but the server is still running with the PUBLIC pipe. Any help would be greatly appreciated.

    Thanks,
    Bill
  • ashitpro
    Recognized Expert Contributor
    • Aug 2007
    • 542

    #2
    You can trap the Ctrl+C and handle it with your own way...
    But the thing is when you hit Ctrl+C to client program it's quite difficult to provide this interrupt to server..
    I mean, Ideally both programs are supposed to run on different machine..
    In your case both are running on same machine, so this will help here.
    Are you sure about this?

    Comment

    Working...