-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: sctp connection using usrsctp #11
base: master
Are you sure you want to change the base?
Conversation
let udp = UdpTransport.new(laddr) | ||
let stun = Stun.new(udp) | ||
let dtls = Dtls.new(stun) | ||
let sctp = Sctp.new(dtls) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the final instance that matter is sctp
, maybe we could just have something like Sctp.new(laddr)
?
let sctp = Sctp.new(dtls) | ||
|
||
let conn = await sctp.connect(initTAddress("127.0.0.1:4242"), sctpPort = 13) | ||
while true: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could do this only a few times, maybe 10?
import ../webrtc/sctp/[sctp_transport, sctp_connection] | ||
|
||
proc main() {.async.} = | ||
let laddr = initTAddress("127.0.0.1:4244") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we fix a local address?
|
||
asyncTest "Two SCTP nodes connecting to each other, then sending/receiving data": | ||
var | ||
sctpServer = initSctpStack(initTAddress("127.0.0.1:4444")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better to use 0 port to avoid errors with port reuse.
Presentation
This PR is part of the stack to create the nim-libp2p webrtc-direct transport (defined here: https://github.com/libp2p/specs/blob/master/webrtc/webrtc-direct.md).
For this PR, we do not implement the full SCTP protocol, we are using the library usrsctp (nim wrapper: https://github.com/status-im/nim-usrsctp / C-library https://github.com/sctplab/usrsctp) to create and use SCTP channels.
SCTP
Stream Control Transmission Protocol (SCTP) is a transport-layer protocol used for transmitting multiple streams of data simultaneously between two endpoints, ensuring reliable, ordered delivery of messages. In the WebRTC stack, SCTP is employed to handle data channels, providing a reliable and unordered delivery of messages, which is critical for real-time communication applications. This allows WebRTC to efficiently transmit diverse types of data, such as text messages, file transfers, or application data, ensuring smooth and reliable communication between peers.