Sets flags that control certain behaviors of a CFSocket object.
- iOS 2.0+
- macOS 10.2+
- Mac Catalyst 13.0+Beta
- tvOS 9.0+
- watchOS 2.0+
- Core Foundation
The CFSocket object to modify.
A bitwise-OR combination of flags controlling the behavior of
s. See CFSocket Flags for the list of available flags.
flags argument controls whether callbacks of a given type are automatically reenabled after they are triggered, and whether the underlying native socket is closed when
s is invalidated.
To set and clear flags, you must set and mask bits in the flag set, respectively. First, call
CFSocket, then modify the value returned. For example:
k callbacks are automatically reenabled after they are triggered, whereas
k callbacks are not;
k callbacks can only occur once, so they cannot be reenabled.
If a callback is automatically reenabled, it is called every time the condition becomes true. For example, a read callback is called as long as there is data on the socket waiting to be read. If a callback is not automatically reenabled, then it gets called exactly once, and is not called again until you manually reenable that callback by calling
Be careful about automatically reenabling read and write callbacks. If you do, the callbacks will be called repeatedly as long as the socket remains readable or writable, respectively.
Be sure to set these flags only for callback types that your CFSocket object actually possesses; the result of setting them for other callback types is undefined.
By default the underlying native socket is closed when
s is invalidated. To disable that, clear (zero) the
k flag. This can be useful when you want to destroy a CFSocket object but continue to use the underlying native socket. The CFSocket object must still be invalidated when you no longer need it.
Do not close the underlying native socket without invalidating the CFSocket object first.