locked
What's the best way to signal one app from another? RRS feed

Answers

  • You append global\ to the name to make an event global. The creation requires the SeCreateGlobalPrivilege privilidge which should only be granted to administrators. I don't think you need a global event since your asp.net web app and the windows service would both be running in session 0.



    Visual C++ MVP

    • Marked as answer by DavidThielen Thursday, October 3, 2013 3:48 PM
    Thursday, October 3, 2013 3:39 PM

All replies

  • It would depend on user cases. a semaphore works well you need to track a count. If you don't, use an event.


    Visual C++ MVP

    Thursday, October 3, 2013 12:39 AM
  • You may want to use a pipe (standard input and standard output) to communicate between multiple applications.  The pipe can be used like a command line where you can send commands and recieve responses between applications.  Semiphore are usually used to indicate when a task has completed or to lock a task when critical sections of code are executing.


    jdweng

    Thursday, October 3, 2013 3:23 AM
  • Nope, no count, I just need to wake up a worker thread in the other app. But I can't find anything on a globally named event - is there such a thing?

    thanks - dave


    Who will win The Windward International Collegiate Programming Championships?

    Thursday, October 3, 2013 1:18 PM
  • The waitone method is a blocking function which can be used as a semiphore.  So you can setup your on event by putting a waitone into a thread and then generate an event when you get past the waitone.

    Class Notify()
    }
       Public StartNotify()
       {
           while(true)
           {
                autoEvent.WaitOne();
                //send notifcation to other class in same applicagtion
           }
       }
    }


    jdweng

    Thursday, October 3, 2013 1:35 PM
  • Hi Joel;

    Yes, that's exactly what I want. However, the signaling application is another app on the machine (the ASP.NET web app is signaling a windows services app). I don't think an event in one application can be signaled by another application.

    Is there a way to do that?

    thanks - dave


    Who will win The Windward International Collegiate Programming Championships?

    Thursday, October 3, 2013 1:39 PM
  • You can use the semiphore to block/unblock another application.  Within an application you can send an event from one thread to another thread.  My code is used to received a signal from different application and then send an event within the same application.

    jdweng

    Thursday, October 3, 2013 1:57 PM
  • You append global\ to the name to make an event global. The creation requires the SeCreateGlobalPrivilege privilidge which should only be granted to administrators. I don't think you need a global event since your asp.net web app and the windows service would both be running in session 0.



    Visual C++ MVP

    • Marked as answer by DavidThielen Thursday, October 3, 2013 3:48 PM
    Thursday, October 3, 2013 3:39 PM