---
title: "CFMessagePortSendRequest(_:_:_:_:_:_:_:)"
framework: corefoundation
role: symbol
role_heading: Function
path: "corefoundation/cfmessageportsendrequest(_:_:_:_:_:_:_:)"
---

# CFMessagePortSendRequest(_:_:_:_:_:_:_:)

Sends a message to a remote CFMessagePort object.

## Declaration

```swift
func CFMessagePortSendRequest(_ remote: CFMessagePort!, _ msgid: Int32, _ data: CFData!, _ sendTimeout: CFTimeInterval, _ rcvTimeout: CFTimeInterval, _ replyMode: CFString!, _ returnData: UnsafeMutablePointer<Unmanaged<CFData>?>!) -> Int32
```

## Parameters

- `remote`: The message port to which data should be sent.
- `msgid`: An arbitrary integer value that you can send with the message.
- `data`: The data to send to remote.
- `sendTimeout`: The time to wait for data to be sent.
- `rcvTimeout`: The time to wait for a reply to be returned.
- `replyMode`: The run loop mode in which the function should wait for a reply. If the message is a oneway (so no response is expected), then replyMode should be NULL. If replyMode is non-NULL, the function runs the run loop waiting for a reply, in that mode. replyMode can be any string name of a run loop mode, but it should be one with input sources installed. You should use the kCFRunLoopDefaultMode constant unless you have a specific reason to use a different mode.
- `returnData`: Upon return, contains a CFData object containing the reply data. Ownership follows the https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFMemoryMgmt/Concepts/Ownership.html#//apple_ref/doc/uid/20001148-103029.

## Return Value

Return Value Error code indicating success or failure. See CFMessagePortSendRequest Error Codes for the possible return values.

## See Also

### Using a Message Port

- [CFMessagePortInvalidate(_:)](corefoundation/cfmessageportinvalidate(_:).md)
- [CFMessagePortSetDispatchQueue(_:_:)](corefoundation/cfmessageportsetdispatchqueue(_:_:).md)
