CFSocketCreateWithSocketSignature incompatible with SO_REUSEADDR
| Originator: | dairgrant | ||
| Number: | rdar://13127171 | Date Originated: | 31-Jan-2013 |
| Status: | Open | Resolved: | |
| Product: | Documentation | Product Version: | N/A |
| Classification: | Enhancemnet | Reproducible: | N/A |
31-Jan-2013 08:57 PM Dair Grant: CFSocketCreateWithSocketSignature creates a socket with CFSocketCreate+CFSocketSetAddress, and CFSocketSetAddress binds the socket. This renders CFSocketCreateWithSocketSignature incompatible with SO_REUSEADDR/SO_REUSEPORT, as these options must be set after the socket is created but before the socket is bound. I would like CFSocketCreateWithSocketSignature's documentation to be updated to point this out, as setsockopt does not provide an error when this option is set on a bound socket. As SO_REUSEADDR is probably the default behaviour you want for listening sockets (side-effects notwithstanding), this API is probably not a good choice for server code. Alternatively CFSocketCreateWithSocketSignature could be deprecated, and a CFSocketCreateBoundSocket API introduced that could take some options to apply to the socket?
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!