Open mikedilger opened 5 years ago
Hi @mikedilger,
I just implemented a unit test for the application I'm working on, similar to what you've described above and it works.
I've used only one UDP port (the default 9899), called usrsctp_init
only once, bind server to a port on all interface and called connect to the Server's SCTP port (no need to bind the client).
Here is excerpt from the tshark -i any -f "port 9899" -V
output
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Version: 4
Header length: 20 bytes
Differentiated Services Field: 0x00 (DSCP 0x00: Default; ECN: 0x00: Not-ECT (Not ECN-Capable Transport))
0000 00.. = Differentiated Services Codepoint: Default (0x00)
.... ..00 = Explicit Congestion Notification: Not-ECT (Not ECN-Capable Transport) (0x00)
Total Length: 156
Identification: 0xb2b7 (45751)
Flags: 0x02 (Don't Fragment)
0... .... = Reserved bit: Not set
.1.. .... = Don't fragment: Set
..0. .... = More fragments: Not set
Fragment offset: 0
Time to live: 64
Protocol: UDP (17)
Header checksum: 0x8997 [validation disabled]
[Good: False]
[Bad: False]
Source: 127.0.0.1 (127.0.0.1)
Destination: 127.0.0.1 (127.0.0.1)
User Datagram Protocol, Src Port: sctp-tunneling (9899), Dst Port: sctp-tunneling (9899)
Source port: sctp-tunneling (9899)
Destination port: sctp-tunneling (9899)
Length: 136
Checksum: 0xfe9b [validation disabled]
[Good Checksum: False]
[Bad Checksum: False]
Stream Control Transmission Protocol, Src Port: 64839 (64839), Dst Port: 58707 (58707)
Source port: 64839
Destination port: 58707
1 0.000000000 127.0.0.1 -> 127.0.0.1 SCTP 172 INIT
2 0.000083330 127.0.0.1 -> 127.0.0.1 SCTP 492 INIT_ACK
3 0.000152627 127.0.0.1 -> 127.0.0.1 SCTP 400 COOKIE_ECHO
4 0.000233159 127.0.0.1 -> 127.0.0.1 SCTP 60 COOKIE_ACK
5 0.000349945 127.0.0.1 -> 127.0.0.1 SCTP 84 DATA
6 0.000540295 127.0.0.1 -> 127.0.0.1 SCTP 72 SACK
7 0.002164253 127.0.0.1 -> 127.0.0.1 SCTP 80 DATA
Thanks for running that test. I'll investigate further when I get time to work on this again, but at this point it sounds like I must be doing something wrong on my side.
Is there any way to communicate over SCTP (over UDP) on localhost between two threads in the same program? My use case is a test suite. I'm wrapping usrsctp for the rust language.
I would presume the two threads would need to be working with different UDP encapsulation ports. But I also presume
usrsctp_init()
is called only once and the structures are shared by all the threads, thus not having separate ports to communicate to each other over.I tried just using the default 9899 for both threads, but using the same SCTP address/port in both bind() in the server thread, and connect() in the client thread, but nothing happens (and wireshark shows no activity).