On 19/12/10 17:17 +0100, Paul J Stevens wrote:
> On 12/19/2010 02:42 PM, "Cédric Krier" <[email protected]>" wrote:
> 
> > 
> > So we need to get a way to find others running tryton client on the host 
> > (this
> > is not too complicated).
> 
> I hope you don't intend to open a URI in another user's tryton client!

No for same local user.

> 
> 
> > But we need to have a way to communicate with those running client and this
> > communication should work on every OS's (Unix (Linux, MacOSX) and Windows).
> > 
> > We already thought about some solutions:
> > 
> >     - use a TCP socket on localhost for a range of port
> >         - not really secure
> >         - could have firewall issue
> >         - limit the number of running client
> > 
> >     - use a file in .config directory for each processes
> >         - need to lock writing/reading operation on the file
> >         - could be slow to use filesystem
> 
> I don't understand. Why worry about performance? Do you expect DoS attacks?

Because it needs to check for input on the file.

> 
> > Any others ideas?
> 
> How about a FIFO file in a .tryton/ or .config/ directory. The GUI can
> run a thread blocking in read(2) on the FIFO. Writing the URI to the
> FIFO would trigger a read(2) action in the client, and the subsequent
> validation and opening of the URI read.

Yes but os.mkfifo works only on Unix.

But it seems that pywin32 got win32pipe module that manage named pipe.
So I will be interest if someone got experiences with this module.

> So when you run 'tryton <URI>' the client will check for existence of
> the fifo and a running client under the same euid.

Just fifo file with the write permission.

> If both exist, write
> the URI to the fifo and exit. If they don't start the gui, open the URI
> and spawn a thread to listen on the fifo created.

It is more complex, we must find a client connected to the same couple
(server, database). So I thought about creating named pipe with a name that
match the server and the database like: [email protected] (perhaps
resolving the server name but I'm not sure).

-- 
Cédric Krier

B2CK SPRL
Rue de Rotterdam, 4
4000 Liège
Belgium
Tel: +32 472 54 46 59
Email/Jabber: [email protected]
Website: http://www.b2ck.com/

Attachment: pgpLXeqh7ilwN.pgp
Description: PGP signature

Reply via email to