Xirsys.Sockets.Transport.SCTP (xturn_sockets v2.2.1)
View SourceSCTP transport (:gen_sctp) when the OTP driver is available.
What problem this solves
Some deployments listen for SCTP over IP directly via OTP's :gen_sctp. This
module implements the Transport behaviour for that path: bind, send on stream
0, and normalize {:sctp, ...} messages.
Not WebRTC SCTP-over-DTLS; see SctpAssociation for the sans-IO path used
with DTLS application data.
accept/2 always returns {:error, :sctp_not_supported} because associations
arrive as messages on the listen socket and cannot be driven by Acceptor's
accept loop.
iex> Xirsys.Sockets.Transport.SCTP.framing()
:datagram
iex> Xirsys.Sockets.Transport.SCTP.handle_message({:sctp, :sock, {127, 0, 0, 1}, 9, [], "hi"}, :sock)
{:data, "hi", {{127, 0, 0, 1}, 9}}
iex> Xirsys.Sockets.Transport.SCTP.handle_message({:sctp_closed, :sock}, :sock)
{:closed, :normal}RFCs
- RFC 4960 - SCTP (streams, associations)
Summary
Functions
SCTP has no accept/2; associations arrive as messages on the listen socket.
Always returns {:error, :sctp_not_supported} so callers use a custom
association handler instead of Acceptor's accept loop.
Parameters
_listen_sock- SCTP listen socket (unused)_timeout- accept timeout (unused)