CFSocketCreate(_:_:_:_:_:_:_:)
Creates a CFSocket object of a specified protocol and type.
Declaration
func CFSocketCreate(_ allocator: CFAllocator!, _ protocolFamily: Int32, _ socketType: Int32, _ protocol: Int32, _ callBackTypes: CFOptionFlags, _ callout: CFSocketCallBack!, _ context: UnsafePointer<CFSocketContext>!) -> CFSocket!Parameters
- allocator:
The allocator to use to allocate memory for the new object. Pass
NULLor Kcfallocatordefault to use the current default allocator. - protocolFamily:
The protocol family for the socket. If negative or 0 is passed, the socket defaults to
PF_INET. - socketType:
The socket type to create. If
protocolFamilyisPF_INETandsocketTypeis negative or 0, the socket type defaults toSOCK_STREAM. - protocol:
The protocol for the socket. If
protocolFamilyisPF_INETandprotocolis negative or 0, the socket protocol defaults toIPPROTO_TCPifsocketTypeisSOCK_STREAMorIPPROTO_UDPifsocketTypeisSOCK_DGRAM. - callBackTypes:
A bitwise-OR combination of the types of socket activity that should cause
calloutto be called. See Cfsocketcallbacktype for the possible activity values. - callout:
The function to call when one of the activities indicated by
callBackTypesoccurs. - context:
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 beNULL.
Return Value
The new CFSocket object, or NULL if an error occurred. Ownership follows the The Create Rule.