My app is being launched via cmd line and if another instance exist i send it the cmd line data via pipes. I am using NamedPipeServerStream ATM. The problem is when i listen for incoming data i may not get it. and ATM because of WaitForConnection is blocking i have no way of terminating my app.
Alternatively i am thinking about not sending the cmd line data and just inserting it to the DB but then i'd need a way to send a msg to the running instance. The way should be mono compatible. I am thinking just dont bother and check the DB for updates every few minutes.
Related Question: http://stackoverflow.com/questions/1689360/best-way-to-keep-a-pipe-open-after-a-remote-close
using (NamedPipeServerStream pipeStream = new NamedPipeServerStream(pipename))
{
pipeStream.WaitForConnection();