---
title: "CFMessagePortGetContext(_:_:)"
framework: corefoundation
role: symbol
role_heading: Function
path: "corefoundation/cfmessageportgetcontext(_:_:)"
---

# CFMessagePortGetContext(_:_:)

Returns the context information for a CFMessagePort object.

## Declaration

```swift
func CFMessagePortGetContext(_ ms: CFMessagePort!, _ context: UnsafeMutablePointer<CFMessagePortContext>!)
```

## Parameters

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

## Discussion

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

## See Also

### Examining a Message Port

- [CFMessagePortGetInvalidationCallBack(_:)](corefoundation/cfmessageportgetinvalidationcallback(_:).md)
- [CFMessagePortGetName(_:)](corefoundation/cfmessageportgetname(_:).md)
- [CFMessagePortIsRemote(_:)](corefoundation/cfmessageportisremote(_:).md)
- [CFMessagePortIsValid(_:)](corefoundation/cfmessageportisvalid(_:).md)
