---
title: "CFStreamCreatePairWithPeerSocketSignature(_:_:_:_:)"
framework: corefoundation
role: symbol
role_heading: Function
path: "corefoundation/cfstreamcreatepairwithpeersocketsignature(_:_:_:_:)"
---

# CFStreamCreatePairWithPeerSocketSignature(_:_:_:_:)

Creates readable and writable streams connected to a socket.

## Declaration

```swift
func CFStreamCreatePairWithPeerSocketSignature(_ alloc: CFAllocator!, _ signature: UnsafePointer<CFSocketSignature>!, _ readStream: UnsafeMutablePointer<Unmanaged<CFReadStream>?>!, _ writeStream: UnsafeMutablePointer<Unmanaged<CFWriteStream>?>!)
```

## Parameters

- `alloc`: The allocator to use to allocate memory for the new objects. Pass NULL or doc://com.apple.corefoundation/documentation/CoreFoundation/kCFAllocatorDefault to use the current default allocator.
- `signature`: A doc://com.apple.corefoundation/documentation/CoreFoundation/CFSocketSignature structure identifying the communication protocol and address to which the socket streams should connect.
- `readStream`: On return, a readable stream connected to the socket address in signature. If you pass NULL, this function will not create a readable stream. Ownership follows the https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFMemoryMgmt/Concepts/Ownership.html#//apple_ref/doc/uid/20001148-103029.
- `writeStream`: On return, a writable stream connected to the socket address in signature. If you pass NULL, this function will not create a writable stream. Ownership follows the https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFMemoryMgmt/Concepts/Ownership.html#//apple_ref/doc/uid/20001148-103029.

## Discussion

Discussion The streams do not create a socket or connect to the remote 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

### Creating Streams

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