Message270669
The Windows problem, error 10022 = WSAEINVAL from getsockname(), seems to be documented at <https://msdn.microsoft.com/en-us/library/windows/desktop/ms738543%28v=vs.85%29.aspx>: “The socket has not been bound”.
Regarding the SCTP problem, raising an error seems like an OS bug to me. However, according to POSIX <http://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockname.html>, we cannot rely on getsockname() indicating any particular address family if the socket is unbound.
So on some platforms, it seems like it will only work with bound sockets, or you have to use less-standard options like SO_PROTOCOL_INFO or SO_DOMAIN. Although SO_DOMAIN won’t help on Free BSD. The simplest solution may be to document and test that it only works with bound sockets.
For the problem with SO_PROTOCOL being unsupported at run-time, I think it would be better to anticipate EINVAL now, rather than wait for someone to complain. But it is not a big deal. |
|
Date |
User |
Action |
Args |
2016-07-17 23:52:53 | martin.panter | set | recipients:
+ martin.panter, nascheme, SilentGhost |
2016-07-17 23:52:53 | martin.panter | set | messageid: <1468799573.49.0.783421887988.issue27377@psf.upfronthosting.co.za> |
2016-07-17 23:52:53 | martin.panter | link | issue27377 messages |
2016-07-17 23:52:53 | martin.panter | create | |
|