Open toddr opened 6 years ago
Given no response to the comment made by @leont in 2012, I'm going to close this. Please re-open if you still would like to discuss this further.
I do think this ticket is valid, but realistically it needs Socket
to have more SCTP
support
How would you like to action this then? Do we want a perl RT about this?
IMO we should improve our sctp support, the question is should it be SOCK_STREAM
or SOCK_SEQPACKET
by default. @leonerd got an opinion?
I don't really know enough about SCTP or the uses of it to suggest either way
@Leont Perhaps rather than just sctp
, there could be both sctp_one
(SOCK_STREAM) and sctp_many
(SOCK_SEQPACKET)?
Both interface styles are of legitimate interest.
Perhaps rather than just sctp, there could be both sctp_one (SOCK_STREAM) and sctp_many (SOCK_SEQPACKET)?
I think that would only be more confusing. Also, this is only about the default (you can still override the Type
argument to set the other), so ultimately it's not all that important.
I think that would only be more confusing.
In order to use SCTP usefully, though, you have to know whether you want TCP-style/one-to-one or UDP-style/one-to-many, right? It seems to me that any confusion that results from having sctp_one
and sctp_many
has more to do with not understanding that SCTP does both one-to-one (à la TCP) and one-to-many (à la UDP) interactions.
SOCK_SEQPACKET
doesn't mean one-to-many. It means sequential packets (much like a stream, but with actual packet boundaries; or like connected UDP but reliable and ordered).
While SCTP does support multihoming, I don't think that would fit into the interface of IO::Socket::INET
/IO::Socket::IP
. That will probably require an IO::Socket::SCTP
module that probably should at least start out its life outside of this distribution.
@Leont
SOCK_SEQPACKET doesn't mean one-to-many.
Hrm? Where are you reading that? sctp(7) says:
A one-to-many style interface with 1 to MANY relationship between socket
and associations where the outbound association setup is implicit. The
syntax of a one-to-many style socket() call is
sd = socket(PF_INET, SOCK_SEQPACKET, IPPROTO_SCTP);
Yeah I didn't have that manpage until I just installed it.
I still don't think it'd be helpful to deviate from the socket API too much here (in other words, have 2 arguments instead of 1)
How would 2 args conform better to the socket API?
It seems to me that the current behaviour is reasonable, I don't think we can reasonable select one socket type over the other, so it's reasonable to expect the caller to supply that themselves.
The error returned could be improved though:
$ ./perl -Ilib -MIO::Socket::INET -e '$x = IO::Socket::INET->new(Proto => 'sctp') or die;'
IO::Socket::INET: Socket type not supported ...propagated at -e line 1.
and that could be improved, maybe:
No default socket type for 'sctp', supply a Type parameter.
would be an improvement.
It seems to me that the current behaviour is reasonable, I don't think we can reasonable select one socket type over the other, so it's reasonable to expect the caller to supply that themselves.
Actually, that is probably the most reasonable suggestion :-)
Migrated from rt.cpan.org#68902 (status was 'open')
Requestors:
From pro@cpan.org on 2011-06-17 19:12:49:
From leont@cpan.org on 2012-02-21 19:50:18:
I'm not sure this is the most sensible of behaviors. sctp can be used as both a SOCK_STREAM and a SOCK_SEQPACKET: but the former doesn't really make sense (what'd be the advantage over tcp?).
Leon