On 22/07/2019 09:16, František Kučera wrote:
It is a stream or a datagram socket – just from different domain (UNIX
instead of INET or INET6) – but they work the same way. So yes, when I
create a stream or datagram unix domain socket e.g. in systemd (parent
process), I can inherit it in Java and get ServerSocketChannel or
DatagramChannel from System.inheritedChannel() and it really works.
Recently, I wrote an article about it: https://blog.frantovo.cz/c/372/
– it is in Czech, but code and config examples should be readable to
anyone.
:
BTW: the inheritedChannel() JavaDoc says:
> In addition to the network-oriented channels described, this method
may return other kinds of channels in the future.
Yes, we added this method in Java SE 5 with a view to supporting other
channel types (e.g. console) in the future.
I'll get back to you on the other points soon but I was curious about
your observation that the inheritedChannel returns a channels with
"garbage" local/remote addresses when fd 0 is a Unix domain socket. The
bug is that the probe is missing a call to getsockname that it needs to
check if the family is AF_INET or AF_INET6. So we should minimally fix that.
-Alan