RFR 8245194: Unix domain socket channel implementation
Michael McMahon
michael.x.mcmahon at oracle.com
Fri Jul 10 10:25:56 UTC 2020
On 09/07/2020 15:14, Chris Hegarty wrote:
>
>
>> On 8 Jul 2020, at 11:07, Michael McMahon
>> <michael.x.mcmahon at oracle.com <mailto:michael.x.mcmahon at oracle.com>>
>> wrote:
>>
>>> ...
>>>
>>> My initial reaction to seeing verbiage like "Internet protocol
>>> socket” and “unix domain socket”, is how does one know what type of
>>> socket channel one has if passed an unbound channel? I wonder if a
>>> SocketChannel::protocolFamily method is worth adding? It could be
>>> used and linked to from some of the verbiage elsewhere to tighten
>>> the spec. There could also be some tie in here with inheritedChannel
>>> - if the protocol family is retrievable.
>> I did consider that question and had concluded that testing the type
>> of the SocketAddress returned by getLocalAddress() would suffice for
>> this. But, you're right that does not work for unbound channels. I'll
>> add this to the API for now (for SocketChannel and
>> ServerSocketChannel in the sandbox), to see what it looks like.
>> Perhaps, for consistency it should be added to DatagramChannel too?
>
> That works for me.
>
> What is the signature of this method? `Optional<ProtocolFamily>
> protocolFamily()` - or something else? If not optional ( or null ),
> then what is the family of a channel created with the no-args open
> method? We had some offline discussion about UNSPEC, and if we add
> this method then it could be a reason to add an UNSPEC
> StandardProtocolFamily.
>
"public ProtocolFamily getProtocolFamily()"
I think a channel will always have a ProtocolFamily. So, it shouldn't
need to be Optional<>
The value on the no-args call depends on the preferIPv4Stack setting.
INET if set INET6 if not,
depending on which of IPv4/IPv6 are supported obviously. Do you think
all of this would need
to be documented explicitly?
Michael
> -Chris.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/nio-dev/attachments/20200710/b431be9e/attachment.htm>
More information about the nio-dev
mailing list