Defining address family at SRT socket creation time #1789
Replies: 2 comments 2 replies
-
Let me describe the general situation concerning sockets. First thing is to create a socket. Then, depending on purpose, various things would be made with it. Currently in SRT we have caller, listener and rendezvous.
Result: no matter the mode, in most cases the creation will be followed by In result, there's absolutely no purpose in specifying the "family" when creating a socket. The only thing that a "fixed" family will do on a socket is that it will increase opportunities for runtime errors. The reason why the BSD socket API requires specification of the family during socket creation could be:
There aren't any known scenarios where having a fixed family on a newly created socket would be of any benefit for the application. |
Beta Was this translation helpful? Give feedback.
-
@maxsharabayko Thank you for raising this again. You were raising the point about the use case? Well, in our product we have a clear separation between IPv4 and IPv6. Creating a socket for this mode did not create an overhead as we favour the BSD socket APIs. Now for SRT once we advance our SRT release beyond V1.4.1 we need to create a specific solution and that is the unfavourable option. @ethouris Perhaps before making changes like this it would be much appreciated to check if anybody actually needs that API and come forward with a god reason. I agree that most parameters were ignored but keeping in line with the BSD socket API was good and we used it. Now since the API has been removed I have got 2 options:
Somewhat I lean to option 2 though... Thank you for reading this. Kind regards, |
Beta Was this translation helpful? Give feedback.
-
Some background
The discussion is extracted from #691.
With the release of SRT version 1.4.2 the API
srt_socket(int af, int type, int protocol)
became deprecated in favor of the newer APIsrt_create_socket()
. The latter one does not let specifying the address family such asAF_INET
orAF_INET6
.The old API function was similar to the Linux socket creation interface, thus SRT API looked more familiar to new users.
The
type
andprotocol
arguments always had only one expected value. Theaf
parameter became unused in 1.4.2 with a change in socket family handling.Current API
To create an IPv6 SRT socket using
srt_create_socket()
you would need to bind it either to a specific IPv6 address or to IPv6 any (e.g.IN6ADDR_ANY_INIT
).There is also a useful socket option
SRTO_IPV6ONLY
.Why would you specify address family at socket creation
Possible advantages of specifying socket family in
srt_socket(..)
:Not sure though if it covers any use cases of SRT integrators.
Beta Was this translation helpful? Give feedback.
All reactions