Interface Peer


public interface Peer
The org.freedesktop.DBus.Peer interface provides basic peer-to-peer functionality between D-Bus connections. This interface is typically implemented by all D-Bus objects and provides fundamental operations.

The Peer interface is often used for:

  • Testing connectivity between D-Bus peers
  • Obtaining machine identifiers for security or logging
  • Basic heartbeat/keepalive functionality
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the machine ID of the peer.
    void
    Pings the peer to test connectivity.
  • Method Details

    • ping

      void ping()
      Pings the peer to test connectivity.

      This method does nothing and returns nothing. It is primarily used to test whether the target object exists and is reachable. If this method returns without error, the connection is working properly.

      Common uses include:

      • Connection health checks
      • Keepalive messages to prevent connection timeout
      • Verifying that a service is running
    • getMachineId

      DBusString getMachineId()
      Gets the machine ID of the peer.

      The machine ID is a unique identifier for the machine where the peer is running. This is typically a randomly-generated UUID that remains stable across reboots. On Linux systems, this usually corresponds to the contents of /etc/machine-id or /var/lib/dbus/machine-id.

      The machine ID is useful for:

      • Identifying remote machines in distributed systems
      • Security logging and auditing
      • License management and node counting
      Returns:
      A DBusString containing the machine ID (typically a 32-character hex string)