---
title: "CFSocketCreateRunLoopSource(_:_:_:)"
framework: corefoundation
role: symbol
role_heading: Function
path: "corefoundation/cfsocketcreaterunloopsource(_:_:_:)"
---

# CFSocketCreateRunLoopSource(_:_:_:)

Creates a CFRunLoopSource object for a CFSocket object.

## Declaration

```swift
func CFSocketCreateRunLoopSource(_ allocator: CFAllocator!, _ s: CFSocket!, _ order: CFIndex) -> CFRunLoopSource!
```

## 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.
- `s`: The CFSocket object for which to create a run loop source.
- `order`: A priority index indicating the order in which run loop sources are processed. When multiple run loop sources are firing in a single pass through the run loop, the sources are processed in increasing order of this parameter. If the run loop is set to process only one source per loop, only the highest priority source, the one with the lowest order value, is processed.

## Return Value

Return Value The new CFRunLoopSource object for s. Ownership follows the The Create Rule.

## Discussion

Discussion The run loop source is not automatically added to a run loop. To add the source to a run loop, use CFRunLoopAddSource(_:_:_:).

## See Also

### Using Sockets

- [CFSocketConnectToAddress(_:_:_:)](corefoundation/cfsocketconnecttoaddress(_:_:_:).md)
- [CFSocketGetTypeID()](corefoundation/cfsocketgettypeid().md)
- [CFSocketInvalidate(_:)](corefoundation/cfsocketinvalidate(_:).md)
- [CFSocketIsValid(_:)](corefoundation/cfsocketisvalid(_:).md)
- [CFSocketSendData(_:_:_:_:)](corefoundation/cfsocketsenddata(_:_:_:_:).md)
