Mac Developer Library

Developer

CoreFoundation Framework Reference Socket Name Server Utilities Reference

Options
Deployment Target:

On This Page
Language:

Socket Name Server Utilities Reference

Inheritance


Not Applicable

Conforms To


Not Applicable

Import Statement


Swift

import CoreFoundation

Objective-C

@import CoreFoundation;

Name server functionality is currently inoperable in OS X.

Functions

  • Returns a socket signature registered with a CFSocket name server.

    Declaration

    Swift

    func CFSocketCopyRegisteredSocketSignature(_ nameServerSignature: UnsafePointer<CFSocketSignature>, _ timeout: CFTimeInterval, _ name: CFString!, _ signature: UnsafeMutablePointer<CFSocketSignature>, _ nameServerAddress: UnsafeMutablePointer<Unmanaged<CFData>?>) -> CFSocketError

    Objective-C

    CFSocketError CFSocketCopyRegisteredSocketSignature ( const CFSocketSignature *nameServerSignature, CFTimeInterval timeout, CFStringRef name, CFSocketSignature *signature, CFDataRef *nameServerAddress );

    Parameters

    nameServerSignature

    The socket signature for the name server. If NULL, this function contacts the default server, which is assumed to be a local process using TCP/IP to listen on the port number returned from CFSocketGetDefaultNameRegistryPortNumber. If nameServerSignature is incomplete, the missing values are replaced with the default server’s values, if appropriate.

    timeout

    The time to wait for the server to accept a connection and to reply to the registration request.

    name

    The name of the registered socket signature to retrieve.

    signature

    A pointer to a CFSocketSignature structure into which the retrieved socket signature is copied.

    nameServerAddress

    A pointer to a CFData object into which the name server’s address is copied. Pass NULL if you do not want the server’s address.

    Return Value

    An error code indicating success or failure.

    Discussion

    Once you have the socket signature, you can open a connection to that socket with CFSocketCreateConnectedToSocketSignature.

    Import Statement

    Objective-C

    @import CoreFoundation;

    Swift

    import CoreFoundation

    Availability

    Available in OS X v10.0 and later.

  • Returns a value registered with a CFSocket name server.

    Declaration

    Swift

    func CFSocketCopyRegisteredValue(_ nameServerSignature: UnsafePointer<CFSocketSignature>, _ timeout: CFTimeInterval, _ name: CFString!, _ value: UnsafeMutablePointer<Unmanaged<CFPropertyList>?>, _ nameServerAddress: UnsafeMutablePointer<Unmanaged<CFData>?>) -> CFSocketError

    Objective-C

    CFSocketError CFSocketCopyRegisteredValue ( const CFSocketSignature *nameServerSignature, CFTimeInterval timeout, CFStringRef name, CFPropertyListRef *value, CFDataRef *nameServerAddress );

    Parameters

    nameServerSignature

    The socket signature for the name server. If NULL, this function contacts the default server, which is assumed to be a local process using TCP/IP to listen on the port number returned from CFSocketGetDefaultNameRegistryPortNumber. If nameServerSignature is incomplete, the missing values are replaced with the default server’s values, if appropriate.

    timeout

    The time to wait for the server to accept a connection and to reply to the registration request.

    name

    The name of the registered value to return.

    value

    A pointer to the property list object into which the retrieved value should be copied.

    nameServerAddress

    A pointer to a CFData object into which the name server’s address is copied. Pass NULL if you do not want the server’s address.

    Return Value

    An error code indicating success or failure.

    Import Statement

    Objective-C

    @import CoreFoundation;

    Swift

    import CoreFoundation

    Availability

    Available in OS X v10.0 and later.

  • Returns the default port number with which to connect to a CFSocket name server.

    Declaration

    Swift

    func CFSocketGetDefaultNameRegistryPortNumber() -> UInt16

    Objective-C

    UInt16 CFSocketGetDefaultNameRegistryPortNumber ( void );

    Return Value

    The default port number with which to connect to a CFSocket name server.

    Discussion

    If you do not provide a name server signature or leave out the socket address in the signature when calling one of the name registry functions, such as CFSocketRegisterSocketSignature, the returned port number is used for the connection.

    Import Statement

    Objective-C

    @import CoreFoundation;

    Swift

    import CoreFoundation

    Availability

    Available in OS X v10.0 and later.

  • Registers a socket signature with a CFSocket name server.

    Declaration

    Swift

    func CFSocketRegisterSocketSignature(_ nameServerSignature: UnsafePointer<CFSocketSignature>, _ timeout: CFTimeInterval, _ name: CFString!, _ signature: UnsafePointer<CFSocketSignature>) -> CFSocketError

    Objective-C

    CFSocketError CFSocketRegisterSocketSignature ( const CFSocketSignature *nameServerSignature, CFTimeInterval timeout, CFStringRef name, const CFSocketSignature *signature );

    Parameters

    nameServerSignature

    The socket signature for the name server. If NULL, this function contacts the default server, which is assumed to be a local process using TCP/IP to listen on the port number returned from CFSocketGetDefaultNameRegistryPortNumber. If nameServerSignature is incomplete, the missing values are replaced with the default server’s values, if appropriate.

    timeout

    The time to wait for the server to accept a connection and to reply to the registration request.

    name

    The name with which to register signature.

    signature

    The socket signature to register.

    Return Value

    An error code indicating success or failure.

    Discussion

    Once a socket signature is registered, other processes can retrieve it with CFSocketCopyRegisteredSocketSignature and then open a connection to your socket using CFSocketCreateConnectedToSocketSignature.

    To remove a registered socket signature from the name server, use CFSocketUnregister.

    Import Statement

    Objective-C

    @import CoreFoundation;

    Swift

    import CoreFoundation

    Availability

    Available in OS X v10.0 and later.

  • Registers a property-list value with a CFSocket name server.

    Declaration

    Swift

    func CFSocketRegisterValue(_ nameServerSignature: UnsafePointer<CFSocketSignature>, _ timeout: CFTimeInterval, _ name: CFString!, _ value: CFPropertyList!) -> CFSocketError

    Objective-C

    CFSocketError CFSocketRegisterValue ( const CFSocketSignature *nameServerSignature, CFTimeInterval timeout, CFStringRef name, CFPropertyListRef value );

    Parameters

    nameServerSignature

    The socket signature for the name server. If NULL, this function contacts the default server, which is assumed to be a local process using TCP/IP to listen on the port number returned from CFSocketGetDefaultNameRegistryPortNumber. If nameServerSignature is incomplete, the missing values are replaced with the default server’s values, if appropriate.

    timeout

    The time to wait for the server to accept a connection and to reply to the registration request.

    name

    The name with which to register value.

    value

    The property-list value to register.

    Return Value

    An error code indicating success or failure.

    Discussion

    To remove a registered value from the name server, use CFSocketUnregister.

    Import Statement

    Objective-C

    @import CoreFoundation;

    Swift

    import CoreFoundation

    Availability

    Available in OS X v10.0 and later.

  • Sets the default port number with which to connect to a CFSocket name server.

    Declaration

    Swift

    func CFSocketSetDefaultNameRegistryPortNumber(_ port: UInt16)

    Objective-C

    void CFSocketSetDefaultNameRegistryPortNumber ( UInt16 port );

    Parameters

    port

    The port number to use to connect to the CFSocket name server.

    Discussion

    If you do not provide a name server signature or leave out the socket address in the signature when calling one of the name registry functions, such as CFSocketRegisterSocketSignature, port will be used for the connection.

    Import Statement

    Objective-C

    @import CoreFoundation;

    Swift

    import CoreFoundation

    Availability

    Available in OS X v10.0 and later.

  • Unregisters a value or socket signature with a CFSocket name server.

    Declaration

    Swift

    func CFSocketUnregister(_ nameServerSignature: UnsafePointer<CFSocketSignature>, _ timeout: CFTimeInterval, _ name: CFString!) -> CFSocketError

    Objective-C

    CFSocketError CFSocketUnregister ( const CFSocketSignature *nameServerSignature, CFTimeInterval timeout, CFStringRef name );

    Parameters

    nameServerSignature

    The socket signature for the name server. If NULL, this function contacts the default server, which is assumed to be a local process using TCP/IP to listen on the port number returned from CFSocketGetDefaultNameRegistryPortNumber. If nameServerSignature is incomplete, the missing values are replaced with the default server’s values, if appropriate.

    timeout

    The time to wait for the server to accept a connection and to reply to the registration request.

    name

    The name of the property-list value or socket signature to unregister.

    Return Value

    An error code indicating success or failure.

    Discussion

    The value being unregistered was previously registered with CFSocketRegisterValue or CFSocketRegisterSocketSignature.

    Import Statement

    Objective-C

    @import CoreFoundation;

    Swift

    import CoreFoundation

    Availability

    Available in OS X v10.0 and later.

Constants

Miscellaneous

  • Not used.

    Declaration

    Swift

    let kCFSocketCommandKey: CFString! let kCFSocketNameKey: CFString! let kCFSocketValueKey: CFString! let kCFSocketResultKey: CFString! let kCFSocketErrorKey: CFString! let kCFSocketRegisterCommand: CFString! let kCFSocketRetrieveCommand: CFString!

    Objective-C

    const CFStringRef kCFSocketCommandKey; const CFStringRef kCFSocketNameKey; const CFStringRef kCFSocketValueKey; const CFStringRef kCFSocketResultKey; const CFStringRef kCFSocketErrorKey; const CFStringRef kCFSocketRegisterCommand; const CFStringRef kCFSocketRetrieveCommand;

    Constants

    • kCFSocketCommandKey

      kCFSocketCommandKey

      Not used.

      Available in OS X v10.0 and later.

    • kCFSocketNameKey

      kCFSocketNameKey

      Not used.

      Available in OS X v10.0 and later.

    • kCFSocketValueKey

      kCFSocketValueKey

      Not used.

      Available in OS X v10.0 and later.

    • kCFSocketResultKey

      kCFSocketResultKey

      Not used.

      Available in OS X v10.0 and later.

    • kCFSocketErrorKey

      kCFSocketErrorKey

      Not used.

      Available in OS X v10.0 and later.

    • kCFSocketRegisterCommand

      kCFSocketRegisterCommand

      Not used.

      Available in OS X v10.0 and later.

    • kCFSocketRetrieveCommand

      kCFSocketRetrieveCommand

      Not used.

      Available in OS X v10.0 and later.