Creates a CFSocket object and opens a connection to a remote socket.
- iOS 2.0+
- macOS 10.0+
- UIKit for Mac 13.0+Beta
- tvOS 9.0+
- watchOS 2.0+
- Core Foundation
The allocator to use to allocate memory for the new object. Pass
kto use the current default allocator.
CFSocketidentifying the communication protocol and address to which the CFSocket object should connect.
A bitwise-OR combination of the types of socket activity that should cause
calloutto be called. See
CFSocketfor the possible activity values.
Call Back Type
The function to call when one of the activities indicated by
A structure holding contextual information for the CFSocket object. The function copies the information out of the structure, so the memory pointed to by
contextdoes not need to persist beyond the function call. Can be
The time to wait for a connection to succeed. If a negative value is used, this function does not wait for the connection and instead lets the connection attempt happen in the background. If
k, you will receive a callback when the background connection succeeds or fails.
CFSocket Connect Call Back
The new CFSocket object, or
NULL if an error occurred. Ownership follows the The Create Rule.