---
title: "CFSocketCreateConnectedToSocketSignature(_:_:_:_:_:_:)"
framework: corefoundation
role: symbol
role_heading: Function
path: "corefoundation/cfsocketcreateconnectedtosocketsignature(_:_:_:_:_:_:)"
---

# CFSocketCreateConnectedToSocketSignature(_:_:_:_:_:_:)

Creates a CFSocket object and opens a connection to a remote socket.

## Declaration

```swift
func CFSocketCreateConnectedToSocketSignature(_ allocator: CFAllocator!, _ signature: UnsafePointer<CFSocketSignature>!, _ callBackTypes: CFOptionFlags, _ callout: CFSocketCallBack!, _ context: UnsafePointer<CFSocketContext>!, _ timeout: CFTimeInterval) -> CFSocket!
```

## Parameters

- `allocator`: The allocator to use to allocate memory for the new object. 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 identifying the communication protocol and address to which the CFSocket object should connect.
- `callBackTypes`: A bitwise-OR combination of the types of socket activity that should cause callout to be called. See doc://com.apple.corefoundation/documentation/CoreFoundation/CFSocketCallBackType for the possible activity values.
- `callout`: The function to call when one of the activities indicated by callBackTypes occurs.
- `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 context does not need to persist beyond the function call. Can be NULL.
- `timeout`: 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 callBackTypes includes kCFSocketConnectCallBack, you will receive a callback when the background connection succeeds or fails.

## Return Value

Return Value The new CFSocket object, or NULL if an error occurred. Ownership follows the The Create Rule.

## See Also

### Creating Sockets

- [CFSocketCreate(_:_:_:_:_:_:_:)](corefoundation/cfsocketcreate(_:_:_:_:_:_:_:).md)
- [CFSocketCreateWithNative(_:_:_:_:_:)](corefoundation/cfsocketcreatewithnative(_:_:_:_:_:).md)
- [CFSocketCreateWithSocketSignature(_:_:_:_:_:)](corefoundation/cfsocketcreatewithsocketsignature(_:_:_:_:_:).md)
