bpod_core.ipc.ServiceIterator
- class bpod_core.ipc.ServiceIterator
Bases:
Iterator[ServiceEvent],AbstractContextManagerLazy iterator for service discovery events.
Monitors both local (IPC) and remote (Zeroconf/TCP) services, yielding
ServiceEventinstances as services appear and disappear. Local services are always preferred — if a service is reachable both via IPC and TCP, only the IPC address is yielded.Prefer
iter_services()over instantiating this class directly.- __init__(service_type, properties=None, timeout=10, poll_interval=1, *, local=True, remote=True) None
Initialize the ServiceIterator.
- Parameters:
service_type (
str) – The service type to discover, e.g.,'bpod'.properties (
dict, optional) – Dictionary of expected service properties to match.timeout (
floatorNone, optional) – How many seconds to monitor, by default 10. PassNoneto monitor indefinitely until the iterator is closed.poll_interval (
float, optional) – How often to poll for local service changes, in seconds. Default is 1.local (
bool, optional) – Whether to search for services on the local machine, by default True.remote (
bool, optional) – Whether to also search for services on the network, by default True.
- Return type:
None