I am not sure what my options are. I need to have two processes communicate values and I was willing to try out Publish/Subscriber. Is there a way to do this without any process having to call QValueSpace::initValueSpaceServer() on Linux/Unix?
> From: [email protected] > To: [email protected] > Subject: Re: [Qt-mobility-feedback] publish-subscribe, making sure not > I am not already connected > Date: Tue, 4 Jan 2011 09:59:04 +1000 > CC: [email protected]; [email protected] > > Hi, > > On Thu, 30 Dec 2010 05:42:15 pm ext Bartosh Wroblevksy wrote: > > Please bear with me, as it is late, and I may not write intelligibly. I am > > using the publish-subscribe and it's very useful. What is not so clear to > > me and (probably buried in the wonderful documentation) is if there is a > > method that lets me know if QValueSpace::initValueSpaceServer() has not > > been called by another process for the paths I want to reserve. In other > > words, is there a method that my process can use that tells me that I can > > declare a publisher and subscriber without any problem for the paths I > > want and that it will work. I apologize in advance if this is clearly in > > the documentation. > > There is no such function. It is expected that > QValueSpace::initValueSpaceServer() is only called by the dedicated server > process. All other processes should only be connecting as clients. > > One way of testing if the server is active is to construct a > QValueSpacePublisher or QValueSpaceSubscriber with a valid path and check the > result of the isConnected(). However this will initialise the application as > a client which cannot be undone to re-initialise as a server. > > You can check if the a server process is actively listening to the > communications socket. You can do this with QLocalSocket. Pass > "qt/valuespace_shmlayer" as the server to connect to or "qt/" + > $QT_VALUESPACE_SHMLAYER environment variable if that is being set. Failure > to > connect would mean that the server is not running and > QValueSpace::initValueSpaceServer() should be called. > > Calling QValueSpace::initValueSpaceServer() is, currently, only required when > using the shared memory layer, which is only used on Linux and other Unix > like > operating systems. > > Cheers, > > -- > Aaron McCarthy, Software Engineer > Nokia, Qt Development Frameworks > Level 1, 53 Brandl St, > Brisbane Technology Park, Eight Mile Plains, > QLD, Australia, 4113 > http://qt.nokia.com/
_______________________________________________ Qt-mobility-feedback mailing list [email protected] http://lists.qt.nokia.com/mailman/listinfo/qt-mobility-feedback
