CFStreamCreatePairWithSocketToCFHost(_:_:_:_:_:)
Creates readable and writable streams connected to a given CFHost object.
Declaration
func CFStreamCreatePairWithSocketToCFHost(_ alloc: CFAllocator?, _ host: CFHost, _ port: Int32, _ readStream: UnsafeMutablePointer<Unmanaged<CFReadStream>?>?, _ writeStream: UnsafeMutablePointer<Unmanaged<CFWriteStream>?>?)Parameters
- alloc:
The allocator to use to allocate memory for the
CFReadStreamandCFWriteStreamobjects. PassNULLor kCFAllocatorDefault to use the current default allocator. - host:
A
CFHostobject to which the streams are connected. If unresolved, the host will be resolved prior to connecting. - port:
The TCP port number to which the socket streams should connect.
- readStream:
Upon return, contains a
CFReadStreamobject connected to the hosthoston portport, orNULLif there is a failure during creation. If you passNULL, the function will not create a readable stream. Ownership follows the 20001148 103029. - writeStream:
Upon return, contains a
CFWriteStreamobject connected to the hosthoston portport, orNULLif there is a failure during creation. If you passNULL, the function will not create a writable stream. Ownership follows the 20001148 103029.
Discussion
The streams do not create a socket or connect to the specified host until you open one of the streams.
Most properties are shared by both streams. Setting a shared property for one stream automatically sets the property for the other.
See Also
Streams
CFReadStreamCreateForHTTPRequest(_:_:)CFReadStreamCreateForStreamedHTTPRequest(_:_:_:)kCFStreamPropertyHTTPAttemptPersistentConnectionkCFStreamPropertyHTTPFinalRequestkCFStreamPropertyHTTPFinalURLkCFStreamPropertyHTTPProxykCFStreamPropertyHTTPProxyHostkCFStreamPropertyHTTPProxyPortkCFStreamPropertyHTTPRequestBytesWrittenCountkCFStreamPropertyHTTPResponseHeaderkCFStreamPropertyHTTPSProxyHostkCFStreamPropertyHTTPSProxyPortkCFStreamPropertyHTTPShouldAutoredirectCFWriteStreamCreateWithFTPURL(_:_:)CFReadStreamCreateWithFTPURL(_:_:)