Open suzp1984 opened 3 months ago
I'm unsure about the correct parameter to use with the getaddrinfo
function, which is utilized to obtain an address for binding a socket. Please conduct further research and study on this issue. If you confirm that this issue needs correction, please submit a pull request.
I appreciate your effort in researching and providing examples concerning this issue. However, it seems that more work is needed to fully understand the problem. I recommend reading and studying further, and doing more work to clarify this issue, until you can determine whether it is a bug.
https://github.com/ossrs/srs/blob/fa8096ad0117a085515729e12a3758ca26036552/trunk/src/protocol/srs_protocol_srt.cpp#L197
SRT use UDP socket, so the socket type should be
SOCK_STREAM
, this api is used to get theaddrinfo
with TCP type. It's not accurate, at least no perfect. The usual steps to create a socket (TCP/UDP) is: socket(domain, type, protocol) -> bind(socket, const struct sockaddr*, address_len); I found create a UDP socket and bind with a TCPstruct sockaddr
is ok. It seem the system api is tolerant with this mistake, I also no idea whether it's a mistake or not. But I guess gives the socket a more accurate addr would be better.Here is the code to verify bind socket with a
struct sockaddr
with different type.