Integration / D Bus Interview Questions
Why do D-Bus messages include a serial number?
Every D-Bus message carries a serial number, assigned by the sender and unique per connection, so that replies can be correctly matched back to the call that triggered them, especially since multiple calls can be in flight on the same connection at once.
When a service sends back a method return or an error, it includes a reply_serial header field set to the serial number of the original call. The caller's client library uses that reply_serial to match the incoming reply to the correct pending call, which is essential for asynchronous usage, where several calls might be outstanding simultaneously and replies can arrive out of order relative to when the calls were sent.
Without this, a connection making concurrent async calls would have no reliable way to tell which reply belonged to which original request, especially if two calls to the same method returned similarly shaped results.
More Related questions...