russelltg/srt-rs

Multithread connections

aegroto opened this issue · 3 comments

The README reports this sentence:

The reference implementation of SRT requires 3 threads per sender and 5 threads per receiver.

With srt-rs, you can assign as many connections to exactly as many threads as you want (usually as many as you have cores) using [tokio's](https://tokio.rs/) futures scheduling. This should allow for handing of many more connections.

Does it mean this library supports multiple send/receive on the same SrtSocket? I've read all the examples and as far as I could understand all of them transmit only one object at a time through a single socket.

The documentation quote you reference is referring to the number of OS threads required to maintain a single session/connection/socket for the library. The library does not support multiple sed/receive on the same SrtSocket. Even if the library eventually supports multiple sockets per UDP port or network interface, we would likely introduce another abstraction to the library, for instance SrtPort or SrtInterface, that supported binding multiple SrtSocket's to the same port/interface.

While @robertream is correct about the OS threads thing, you can definitely have multiple sockets (read: streams) on the same UDP socket. Bind a SrtListener and accept as many connections as you want!

That's much clearer now, thanks!