Am Fri, 3 Jun 2016 14:16:32 +0000 schrieb "Murphy, Sean" <smur...@walbro.com>:
> > Thanks for all those suggestions. Of course there are platform specific > > solutions, > > but I'd like to keep the code 100% cross platform everywhere it's possible. > > > > The issue with file locking, is every OS does not have a system-wide > > user-writable standard folder. > > There is /tmp on linux/unix which is standard, but AFAIK windows only has > > per-user temporary file, and system temp which is not user writable. > > > > Also QLocalSocket doesn't do the job under windows, as two processes can > > listen > > on the same name (only one will receive data), the conflict is not reported > > by the API. > > > > It seems there is no very good solution. > > Just throwing a hacky idea out there, but what about listening on a UDP > socket? > - application launches and listens for x seconds, if it doesn't hear anything > it assumes it's the > only instance and starts broadcasting every 0.5x seconds > > There's an obvious race condition if two users start the application almost > simultaneously not sure how worried about that you are? > > Sean what about keeping a server listening all the runtime? this would block the port for listening for the next program, which you can capture and handle as needed. --
pgpkM7IGZyLJc.pgp
Description: OpenPGP digital signature
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest