Node

Undocumented in source.

Constructors

this
this(bool listenForConections, ushort port)

listenForConnections if true enables the listener, and any incoming connections are accepted port determines the port on which the listener will run

Destructor

~this
~this()

Closes all connections, including the listener, and destroys the Node

Members

Functions

closeAllConnections
void closeAllConnections()

Closes all connections

closeConnection
bool closeConnection(uinteger conID)

Closes a connection using it's connection ID Returns true on success, false on failure

connectionExists
bool connectionExists(uinteger conID)

Returns true if a connection ID is assigned to an existing connection

connectionIsEncrypted
bool connectionIsEncrypted(uinteger conID)
generateKeys
void generateKeys(uint length)

generates keys for encrypting messages

getConnections
uinteger[] getConnections()

Returns a list of all connection IDs that are currently assigned to connections, useful for running server

getEvent
NetEvent[] getEvent(TimeVal* timeout)

Waits for an NetEvent to occur, and returns it. A timeout can be provided, if null, max value is used

getHostName
string getHostName(uinteger conID, bool local)

Returns Host name of a connection using connection ID local if true, makes it return local host name, else, remote host name is used If connection doesn't exist, null is retured

getIPAddr
string getIPAddr(uinteger conID, bool local)

Returns IP Address of a connection using connection ID local if true, makes it return the local address, otherwise, remoteAddress is used If connection doesn't exist, null is retured

newConnection
uinteger newConnection(string address, ushort port)

Creates a new connection to address using the port.

sendKey
bool sendKey(uinteger conID)

sends public key to a specific connection

sendKeysToAllConnections
bool sendKeysToAllConnections()

sends public key to all connections

sendMessage
bool sendMessage(uinteger conID, char[] message)

Sends a message to a Node using connection ID

Properties

acceptConnections
bool acceptConnections [@property getter]

Specifies if incoming connections will be accepted by listener. It's value does not have any affect if litenForConnections was specified as false in constructor

acceptConnections
bool acceptConnections [@property setter]

Specifies if incoming connections will be accepted by listener. It's value does not have any affect if litenForConnections was specified as false in constructor

keys
RSAKeyPair keys [@property setter]

use this to set the public and private keys for this Node, or generate random using Node.generateKeys

Meta