CFMessagePort objects provide a communications channel that can transmit arbitrary data between multiple threads or processes on the local machine.
You create a local message port with
CFMessagePortCreateLocal(_:_:_:_:_:) and make it available to other processes by giving it a name, either when you create it or later with
CFMessagePortSetName(_:_:). Other processes then connect to it using
CFMessagePortCreateRemote(_:_:), specifying the name of the port.
Your message port’s callback function will be called when a message arrives. To send data, you store the data in a CFData object and call
CFMessagePortSendRequest(_:_:_:_:_:_:_:). You can optionally have the function wait for a reply and return the reply in another CFData object.
Message ports only support communication on the local machine. For network communication, you have to use a CFSocket object.