---
title: CFStream
framework: corefoundation
role: collectionGroup
role_heading: API Collection
path: corefoundation/cfstream
---

# CFStream

## Overview

Overview This document describes the generic CFStream functions, data types, and constants. See also CFReadStream and CFWriteStream for functions and constants specific to read and write streams respectively. note: When you use the CFStream API for networking, read and write operations on sockets can block. To prevent blocking: Call CFReadStreamSetClient(_:_:_:_:) and CFWriteStreamSetClient(_:_:_:_:) to register to receive stream-related event notifications. Call CFReadStreamScheduleWithRunLoop(_:_:_:) and CFWriteStreamScheduleWithRunLoop(_:_:_:) to schedule the stream on a run loop for receiving stream-related event notifications. Call CFReadStreamOpen(_:) and CFWriteStreamOpen(_:) to open each stream. Read only after receiving a hasBytesAvailable notification. Write only after receiving a canAcceptBytes notification.

## Topics

### Creating Streams

- [CFStreamCreatePairWithPeerSocketSignature(_:_:_:_:)](corefoundation/cfstreamcreatepairwithpeersocketsignature(_:_:_:_:).md)
- [CFStreamCreatePairWithSocketToHost(_:_:_:_:_:)](corefoundation/cfstreamcreatepairwithsockettohost(_:_:_:_:_:).md)
- [CFStreamCreatePairWithSocket(_:_:_:_:)](corefoundation/cfstreamcreatepairwithsocket(_:_:_:_:).md)
- [CFStreamCreateBoundPair(_:_:_:_:)](corefoundation/cfstreamcreateboundpair(_:_:_:_:).md)
- [CFStreamCreatePairWithSocketToCFHost(_:_:_:_:_:)](cfnetwork/cfstreamcreatepairwithsockettocfhost(_:_:_:_:_:).md)
- [CFStreamCreatePairWithSocketToNetService(_:_:_:_:)](cfnetwork/cfstreamcreatepairwithsockettonetservice(_:_:_:_:).md)

### Obtaining Errors

- [CFSocketStreamSOCKSGetError(_:)](cfnetwork/cfsocketstreamsocksgeterror(_:).md)
- [CFSocketStreamSOCKSGetErrorSubdomain(_:)](cfnetwork/cfsocketstreamsocksgeterrorsubdomain(_:).md)

### Setting the Security Protocol

- [CFReadStreamSetProperty(_:_:_:)](corefoundation/cfreadstreamsetproperty(_:_:_:).md)
- [CFWriteStreamSetProperty(_:_:_:)](corefoundation/cfwritestreamsetproperty(_:_:_:).md)
- [CFStream Socket Security Level Constants](corefoundation/cfstream-socket-security-level-constants.md)

### Data Types

- [CFStreamError](corefoundation/cfstreamerror.md)
- [CFStreamClientContext](corefoundation/cfstreamclientcontext.md)

### Constants

- [CFStreamStatus](corefoundation/cfstreamstatus.md)
- [CFStreamErrorDomain](corefoundation/cfstreamerrordomain.md)
- [CFStream Error Domain Constants (CFHost)](corefoundation/cfstream-error-domain-constants-cfhost.md)
- [Error Subdomains](corefoundation/error-subdomains.md)
- [Secure Sockets (SOCKS) Errors](cfnetwork/1518266-secure-sockets-socks-errors.md)
- [CFStreamEventType](corefoundation/cfstreameventtype.md)
- [Stream Properties](corefoundation/stream-properties.md)
- [CFStream Property SSL Settings Constants](corefoundation/cfstream-property-ssl-settings-constants.md)
- [CFStream Socket Security Level Constants](corefoundation/cfstream-socket-security-level-constants.md)
- [CFStream SOCKS Proxy Key Constants](corefoundation/cfstream-socks-proxy-key-constants.md)
- [Stream Service Types](corefoundation/stream-service-types.md)

## See Also

### Related Documentation

- [Getting Started with Networking, Internet, and Web](apple-archive/referencelibrary/GettingStarted/GS_NetworkingInternetWeb/_index.html.md)
- [CFNetwork Programming Guide](apple-archive/documentation/Networking/Conceptual/CFNetwork/Introduction.md)

### Reference

- [Core Foundation Structures](corefoundation/core-foundation-structures.md)
- [Core Foundation Enumerations](corefoundation/core-foundation-enumerations.md)
- [Core Foundation Constants](corefoundation/core-foundation-constants.md)
- [Core Foundation Functions](corefoundation/core-foundation-functions.md)
- [Core Foundation Data Types](corefoundation/core-foundation-data-types.md)
- [Core Foundation Macros](corefoundation/corefoundation-macros.md)
