I guess this isn't the best place to ask this question, but I think there
are knowledgeable people here. I don't know the right place, so I'd
welcome being redirected to a better one.

The POSIX spec for close() is here:
https://pubs.opengroup.org/onlinepubs/9699919799/

This specification has a lot of cases that explicitly apply only to the
last close of an object, either using that language or by saying that
something happens when "all file descriptors associated with" an
object are closed. But it doesn't say that for sockets. Instead, it
just says, "If fildes refers to a socket, close() shall cause the
socket to be destroyed," which implies that closing any file
descriptor for a socket destroys the socket. I think that must be
wrong, because I don't think that's the behavior on the systems
I've used.

Do I misunderstand the spec? Or the behavior on real systems?
(Should I submit a request for clarification to the spec maintainers?)

Thanks,

Ben.

Reply via email to