Re: solisten()
Re: solisten()
- Subject: Re: solisten()
- From: Michael Tuexen <email@hidden>
- Date: Sat, 10 Nov 2007 12:57:36 +0100
On Nov 10, 2007, at 3:35 AM, Terry Lambert wrote:
On Nov 9, 2007, at 1:37 PM, Michael Tuexen wrote:
On Nov 9, 2007, at 9:56 PM, Michael Smith wrote:
On Nov 9, 2007, at 12:13 PM, Michael Tuexen wrote:
why does solisten() in Leopard contain
if ((so->so_proto->pr_flags & PR_CONNREQUIRED) == 0) {
error = EOPNOTSUPP;
goto out;
}
This was not there in Tiger.
I do understand that you can not use listen() for UDP sockets, but
this should be handled in UDP specific code.
Without actually knowing why the change was made, I would point
out that saying "this is a UDP thing" specifically fails to notice
that the code in question basically says "if the protocol does not
require connections, you cannot listen for a connection".
Which is not OK for one2many style sockets for SCTP. SCTP is
connection
oriented but does implicit connection management for you in case of
one2many style sockets. To allow connections being accepted on these
sockets you need to call listen().
Actually, just the fact of having opened a socket in that case
should imply a listen.
We think that this would be a bad idea. If someone writes a client he
might not
want to handle incoming connections. The user has explicitly allow the
kernel to
accept incoming connections on a socket(AF_INET, SOCK_SEQPACKET,
IPPROTO_SCTP)
I agree that it's inappropriate for protocols which *can* have a
connection, but do not require them, and would prefer a PR_CANLISTEN
or something similar, since listening implies specification of a
queue depth, which can be usedful.
We use the backlog parameter on this kind of socket just as a flag to
enable/disable
accepting new SCTP associations.
But this shouldn't stop you from being able to do what you want.
Is it supposed to be possible to send without a connection? If so,
then the SS_ISCONNECTED check of so_state in sosendcheck(),
soreceive(), etc., might end up being problematic (this would be why
I'd have a preference for PR_CANLISTEN/PR_CANCONNECT vs.
PR_CONNREQUIRED, to accomodate protocols wher ethat's the case).
Yes, you can just call sendmsg() and if there is no association, the
kernel will
automatically start one. I agree, PR_CANLISTEN or so would be much
better.
Another alternative would be to have separate socket types for
connection required vs. not sockets, though the software would then
have to treat them as distinct.
Well, we have this:
socket(AF_INET, SOCK_STREAM, IPPROTO_SCTP)
gives you an SCTP socket which behaves pretty similar to an TCP socket,
except that it is a message oriented protocol. Here PR_CONNREQUIRED is
appropriate.
socket(AF_INET, SOCK_SEQPACKET, IPPROTO_SCTP)
gives you an SCTP socket which behaves pretty similar to an UDP socket,
but you need to call listen(fd, 1) to allow the kernel to accept
associations.
The management of the associations is done completely by the kernel.
-- Terry
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden