Number of python RPyC users

I want to use RPyC to provide an API for a hardware board as a service. The board can only serve one user at a time. Is there a way to get RPyC to ensure that only one user can access at a time?

+4
source share
1 answer

I'm not sure if this will work (or work well), but you can try running OneShotServer inside the loop, so only one connection is served at any given time. When the connection is closed, the server ends and you start another for the next client.

Sort of:

is_aborting = False
while not is_aborting:
    server = OneShotServer(myservice, *args, **kwargs)
    # serve the next client:
    server.start()
    # done serving the client

, ThreadedServer _ accept_method, , , , .

+2

Source: https://habr.com/ru/post/1624656/


All Articles