---
title: "CFSocketGetContext(_:_:)"
framework: corefoundation
role: symbol
role_heading: Function
path: "corefoundation/cfsocketgetcontext(_:_:)"
---

# CFSocketGetContext(_:_:)

Returns the context information for a CFSocket object.

## Declaration

```swift
func CFSocketGetContext(_ s: CFSocket!, _ context: UnsafeMutablePointer<CFSocketContext>!)
```

## Parameters

- `s`: The CFSocket object to examine.
- `context`: A pointer to the structure into which the context information for s is to be copied. The information being returned is usually the same information you passed to doc://com.apple.corefoundation/documentation/CoreFoundation/CFSocketCreate(_:_:_:_:_:_:_:), doc://com.apple.corefoundation/documentation/CoreFoundation/CFSocketCreateConnectedToSocketSignature(_:_:_:_:_:_:), doc://com.apple.corefoundation/documentation/CoreFoundation/CFSocketCreateWithNative(_:_:_:_:_:), or doc://com.apple.corefoundation/documentation/CoreFoundation/CFSocketCreateWithSocketSignature(_:_:_:_:_:) when creating the CFSocket object. However, if doc://com.apple.corefoundation/documentation/CoreFoundation/CFSocketCreateWithNative(_:_:_:_:_:) returned a cached CFSocket object instead of creating a new object, context is filled with information from the original CFSocket object instead of the information you passed to the function.

## Discussion

Discussion The context version number for CFSocket is currently 0. Before calling this function, you need to initialize the version member of context to 0.

## See Also

### Configuring Sockets

- [CFSocketCopyAddress(_:)](corefoundation/cfsocketcopyaddress(_:).md)
- [CFSocketCopyPeerAddress(_:)](corefoundation/cfsocketcopypeeraddress(_:).md)
- [CFSocketDisableCallBacks(_:_:)](corefoundation/cfsocketdisablecallbacks(_:_:).md)
- [CFSocketEnableCallBacks(_:_:)](corefoundation/cfsocketenablecallbacks(_:_:).md)
- [CFSocketGetNative(_:)](corefoundation/cfsocketgetnative(_:).md)
- [CFSocketGetSocketFlags(_:)](corefoundation/cfsocketgetsocketflags(_:).md)
- [CFSocketSetAddress(_:_:)](corefoundation/cfsocketsetaddress(_:_:).md)
- [CFSocketSetSocketFlags(_:_:)](corefoundation/cfsocketsetsocketflags(_:_:).md)
