DCNSServer Class Reference

Inherits from NSObject
Declared in DCNSServer.h

Overview

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

Some additional configuration is provided here, such as an adjustable timeout for transmission of messages to a client.

Lifecycle

+ initialiseAsRemoteWithService:portNumber:authenticationDelegate:andError:

Initialises the server-side of Distributed Classes to recieve connections over the local network.

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

Parameters

service

The unique name of the service broadcast by this server over mDNS. This @b cannot be nil.

portNum

The port number to listen on. Passing 0 will automatically use any available port.

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 the server.

Declared In

DCNSServer.h

+ initialiseAsLocalWithService:authenticationDelegate:andError:

Initialises the server-side of Distributed Classes to recieve connections from only localhost.

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

Parameters

service

The unique name of the service to broadcast as.

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 the server.

Declared In

DCNSServer.h

+ shutdownServer

Closes the current connection to the server.

+ (void)shutdownServer

Declared In

DCNSServer.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

DCNSServer.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

DCNSServer.h