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: Best way to keep a pipe open after a remote close
开发者_如何学运维 using (NamedPipeServerStream pipeStream = new NamedPipeServerStream(pipename))
{
pipeStream.WaitForConnection();
精彩评论