How to get tcp listen port

Joshua Swink joshua.swink at gmail.com
Mon Feb 25 14:29:56 PST 2008


On Mon, Feb 25, 2008 at 1:11 PM, Thiago Macieira <thiago at kde.org> wrote:
>
> Joshua Swink wrote:
>  >How can I determine what TCP port dbus-daemon is listening on?
>  >
>  >I have set my system dbus-daemon to listen on a system-selected port,
>  >which it does. I can determine the port as root (e.g., sudo netstat
>  >-ptl). But how can I get the port 1) with user privileges, and 2)
>  >without rebooting?
>
>  Save it in an environment variable (DBUS_SESSION_BUS_ADDRESS). That's how
>  client applications find the bus.
>
>  The same applies to the system bus (DBUS_SYSTEM_BUS_ADDRESS).

It appears I may have to do this, but it would be less than ideal. I'd
rather not edit /etc/init.d/dbus if it isn't absolutely necessary,
since the file will be overwritten when the package gets updated.

I'm curious as to how client applications currently determine the
system dbus address. DBUS_SYSTEM_BUS_ADDRESS doesn't get set, yet they
still find it. Are they just hardcoding
/var/run/dbus/system_bus_socket?

Another downside to this solution is that I'd have to reboot for the
changes to take effect.

Josh


More information about the dbus mailing list