On Sat, 19 Mar 2011 16:56:25 +0200, jack <(E-Mail Removed)> wrote:
>Alessandro Basili wrote:
>> On 3/18/2011 10:29 PM, David W. Hodgins wrote:
>>> On Fri, 18 Mar 2011 22:52:00 -0400, Alessandro Basili
>>> <(E-Mail Removed)> wrote:
>>>
>>>> fairly broad network, I would like to allow only one instance of the
>>>> client to be able to change settings on the servers, while the others
>>>> can only monitor its behavior.
>>>
>>> Have the client gpg sign the commands, and the have the server only
>>> accept the command if the signature is valid.
>>
>> How should I provide a gpg to a single client? where does it get it
>> from? The client here is an instance of a program, is like having
>> several instances of thundirbird sending emails always from the same
>> recipient, how can I allow only one instance of TB sending emails?
>>
>> Maybe I am missing your point.
>>
>With gpg you can allow one particular (pre-determined) client to
>control. Reading the original post, what you are aiming for is something
>like controlling PTZ on a webcam - anybody is allowed to change it, but
>only one person at a time. The proposed scheme will work, it's similar
>to what things such as DHCP do. However I would try to keep all the
>intelligence in the server - if it is possible for the server to
>identify a client (e.g. client IP address/port, if you are using
>persistent TCP connections between client and server), you can set a few
>global variables in the server indicating which IP/port has control, and
>when last it issued a command. If a command comes in from another
>IP/port, and 'last issued command' is more than 5 seconds ago, replace
>the 'current control' by the new IP/port.
Yes, but... The server may be handling multiple request for access in
parallel, so you really want to stream those access into a queue at the
server. Then another process drains the queued requests into actual
webcam (or whatever widget) controls. It is this server that knows about
the requests, can deduplicate queued requests (delay processing requests
by a few seconds, drop any requests that are already in the queue).
Key is to control access to the one resource, and that may be done with
queues and delays. Delays are important when accessing a physical
resource that you don't want to wear out.
OTOH, OP may be asking for session control, where only one client gets
control at a time -- this is where a global variable (as easy as touch
or rm filename in world-writable filespace for the writer, and a [ -f
filename ] ... for the new client) indicates if the resource is busy
and responds to the client accordingly.
Grant.
|