DCNSClient Class Reference

Inherits from NSObject
Declared in DCNSClient.h

Overview

This class provides the API necessary to initialise the library in a client process.

You will need to use the equivalent API that the server process used to initialise itself, i.e., initialiseTo { Local | Remote } as appropriate.

Some additional configuration is provided here, such as the ability to provide a global error handler block, along with an adjustable timeout for transmission of messages to the server.

Lifecycle

+ initialiseToRemoteWithHostname:portNumber:authenticationDelegate:andError:

Initialises the client-side of Distributed Classes to a remote server.

+ (void)initialiseToRemoteWithHostname:(NSString *)host portNumber:(unsigned int)portNum authenticationDelegate:(id<DCNSConnectionDelegate>)delegate andError:(NSError *__autoreleasing *)error

Parameters

host

The hostname of the server to connect to. Passing nil searches for service via Bonjour in the local domain.

portNum

The port number the remote server is listening on. Only used if host is non-NULL.

delegate

The delegate to use for authentication requests. Passing nil will run the system without any authentication.

error

Will contain any errors that arise during establishing a connection

Declared In

DCNSClient.h

+ initialiseToRemoteWithService:authenticationDelegate:andError:

Initialises the client-side of Distributed Classes to a local network server that broadcasts its location via mDNS.

+ (void)initialiseToRemoteWithService:(NSString *)service authenticationDelegate:(id<DCNSConnectionDelegate>)delegate andError:(NSError *__autoreleasing *)error

Parameters

service

The unique name of the service to connect to.

delegate

The delegate to use for authentication requests. Passing nil will run the system without any authentication.

error

Will contain any errors that arise during establishing a connection

Declared In

DCNSClient.h

+ initialiseToLocalWithService:authenticationDelegate:andError:

Initialises the client-side of Distributed Classes to a process on the same machine.

+ (void)initialiseToLocalWithService:(NSString *)service authenticationDelegate:(id<DCNSConnectionDelegate>)delegate andError:(NSError *__autoreleasing *)error

Parameters

service

The unique name of the service to connect to.

delegate

The delegate to use for authentication requests. Passing nil will run the system without any authentication.

error

Will contain any errors that arise during establishing a connection

Declared In

DCNSClient.h

+ closeConnection

Closes the current connection to the server.

+ (void)closeConnection

Declared In

DCNSClient.h

Configuration

+ setTransmissionTimeout:

Configures the timeout when transmitting data to the remote end.

+ (void)setTransmissionTimeout:(NSTimeInterval)timeout

Parameters

timeout

New timeout value in seconds.

Declared In

DCNSClient.h

+ setGlobalErrorHandler:

Configures the global error handler for when communication or transmission errors occur.
See https://github.com/Matchstic/Distributed-Classes/wiki/API:-Options:-Error-Handling for more information.

+ (void)setGlobalErrorHandler:(BOOL ( ^ ) ( DCNSAbstractError *error ))handler

Parameters

handler

The new global handler block.

Declared In

DCNSClient.h