Using .net and w/o using something platform specific is there a way i can get two of my apps to poke eachother? Both apps will be running. This specifically will be a one way poke. I’ll need to pass it an int64 value minimum. It will run on linux with mono but i’ll be developing on windows
-edit- additional info. One process will be asp.net so that means i cant take long to do the poke. The lifetime will be <50ms because its a page request. Also i may have any write/poke request per minute or one every 10+minutes
One approach we’ve used successfully is Named Pipes. In .net 3.5 they added native support so you don’t have to use p/invoke to get at the appropriate win32 APIs.
Check out: http://www.switchonthecode.com/tutorials/dotnet-35-adds-named-pipes-support as an example.
In short, what you’ll be doing is creating a client/server mechanism (the “named pipe”) which has a specified name; the server will set up the pipe and await client connections…the client will connect to the pipe and send data across it.
The nice thing about this is you can send entire data structures easily (provided they’re marked [Serializable]). This allows you to implement particular messages richly (and this includes Enums, too)
One thing to note: by default named pipes are synchronous (blocking) so your call to Connect() will run ~forever if the server is not up. You can either use the asynchronous mode or run your synchronous code in a Thread which you can later abandon/abort. Just keep that in mind when laying the groundwork as the switch to asynchronous pipe usage may be a bit of work if you haven’t planned for it.