apply socket, listen.applysocket, kPMRPCListenApplySocket — Set a socket to listen for incoming connections on.


void listen.applysocket( unique ID,
protocol family,
Bonjour domains,
unique ID : string, default, length 1..255;
interface : string, optional;
port : integer, default, optional, range 0..65536;
protocol family : string, choice, default;
SSL : , optional;
Bonjour domains : array of strings, optional, unique;
options : array of s, optional, unique;


Set a socket to listen for incoming connections on.

apply socket adds or modifies a single socket. Sockets are indexed by their unique ID. If the socket's unique ID is unique, the provided socket is added. If the socket's unique ID matches an existing socket's unique ID, the existing socket is replaced by the provided socket.


unique ID. Unique ID of the socket. unique ID is a string. If unique ID is omitted, a default is created. unique ID must be between 1 and 255 characters long, inclusive.

interface. Interface address, hostname or numeric IP. interface is a string. interface is optional.

port. TCP/IP port number. port is an integer. If port is omitted, the default 0 is used. port is optional. port must be between 0 and 65536, inclusive.

protocol family. Use IPv4 or IPv6 protocol. protocol family is a string. If protocol family is omitted, the default IPv4 is used. protocol family must be one of the following two constants:

  • IPv4, kPMRPCParameterProtocolFamily_ApplySocket_IPv4.
  • IPv6, kPMRPCParameterProtocolFamily_ApplySocket_IPv6.

SSL. Encoded SSL certificate path and options. SSL is a SSL structure. SSL is optional.

Bonjour domains. Bonjour domains to publish within. Bonjour domains is an array of strings. Bonjour domains is optional. Each item in Bonjour domains must be unique.

options. options is an array of socket options elements. options is optional. Each item in options must be unique.


apply socket can be requested by any authenticated client.

Unauthenticated clients are authorized using the right. By default, only local processes belonging to administrator can send a apply socket request.




Example 69. C: Minimal listen.applysocket

CFArrayRef myBonjourDomains = NULL;
CFStringRef myInterface = NULL;
CFArrayRef myOptions = NULL;
CFDictionaryRef mySSL = NULL;

CFMutableDictionaryRef myRequest = PMRequestCreateWithParameters(kCFAllocatorDefault, kPMRPCListenApplySocket, kPMRPCParameterBonjourDomains, myBonjourDomains, kPMRPCParameterInterface, myInterface, kPMRPCParameterOptions, myOptions, kPMRPCParameterSSL, mySSL, nil);