ServiceIterator

class bpod_core.ipc.ServiceIterator

Bases: Iterator[ServiceEvent], AbstractContextManager

Lazy iterator for service discovery events.

Monitors both local (IPC) and remote (Zeroconf/TCP) services, yielding ServiceEvent instances 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.

Parameters:
  • service_type (str) – The service type to discover, e.g., 'bpod'.

  • properties (dict, optional) – Dictionary of expected service properties to match.

  • timeout (float or None, default: 10.0) – How many seconds to monitor. Pass None to monitor indefinitely until the iterator is closed.

  • poll_interval (float, default: 1.0) – How often to poll for local service changes, in seconds.

  • local (bool, default: True) – Whether to search for services on the local machine.

  • remote (bool, default: True) – Whether to also search for services on the network.

Notes

Prefer iter_services() over instantiating this class directly.

close()

Stop monitoring and release all resources.

Return type:

None