Ixian SDK
DLT.Network.NetworkServer Class Reference

Ixian network server object. This is used to accept connections from Ixian clients or other nodes and recieve Ixian protocol messages. Basic protocol validation is performed before a specialized protocol parser is called. More...

Static Public Member Functions

static void beginNetworkOperations ()
 Starts listening for and accepting network connections. More...
 
static void stopNetworkOperations ()
 Stops listening for new connections and disconnects all connected clients. More...
 
static void handleDisconnectedClients ()
 Checks the list of clients and removes the ones who have disconnected since the last check. More...
 
static void restartNetworkOperations ()
 Restarts the network server. More...
 
static bool broadcastData (char[] types, ProtocolMessageCode code, byte[] data, byte[] helper_data, RemoteEndpoint skipEndpoint=null)
 Sends the given data to all appropriate connected clients. More...
 
static bool broadcastEventData (NetworkEvents.Type type, ProtocolMessageCode code, byte[] data, byte[] address, byte[] helper_data, RemoteEndpoint skipEndpoint=null)
 Sends the specified event to all connected clients. The information is only sent to those clients who have previously subscribed to this event type More...
 
static bool forwardMessage (byte[] address, ProtocolMessageCode code, byte[] message)
 Sends the specified network message to the given address, if it is known and connected among clients. More...
 
static bool sendToClient (string neighbor, ProtocolMessageCode code, byte[] data, byte[] helper_data)
 Sends the protocol message to the specified neighbor node, given as a Hostname or IP address and port. More...
 
static string [] getConnectedClients (bool useIncomingPort=false)
 Retrieves all connected remote endpoints as hostnames or IP addresses and optionally ports. More...
 
static bool removeEndpoint (RemoteEndpoint endpoint)
 Removes the given endpoint from the connected client list, but does not immediately issue a disconnect message. More...
 
static int getQueuedMessageCount ()
 Retrieves the number of queued outgoing messages for all clients. More...
 
static RemoteEndpoint getClient (int idx)
 Gets the client by sequential index. More...
 
static void blacklistNode (string ip)
 Adds the speficied node to the blacklist by public IP. More...
 
static bool isNodeBlacklisted (string ip)
 Checks if the specified IP is blacklisted. More...
 
static bool isRunning ()
 Checks if the server is running. More...
 
static bool isConnectable ()
 Returns if the server is proven to be connectable. (Someone has connected to the server successfully within the past 5 minutes.) More...
 

Static Public Attributes

static string publicIPAddress = "127.0.0.1"
 IP address on which the server will listen. For security reasons this is pre-set to the local loopback address and must be specifically overwritten when starting the server. More...
 
static List< RemoteEndpointconnectedClients = new List<RemoteEndpoint>()
 List of connected clients. More...
 
static bool connectable = true
 Flag, indicating whether the listening socket is open and accepting connections. More...
 

Detailed Description

Ixian network server object. This is used to accept connections from Ixian clients or other nodes and recieve Ixian protocol messages. Basic protocol validation is performed before a specialized protocol parser is called.

Definition at line 28 of file NetworkServer.cs.

Member Function Documentation

◆ beginNetworkOperations()

static void DLT.Network.NetworkServer.beginNetworkOperations ( )
static

Starts listening for and accepting network connections.

Definition at line 64 of file NetworkServer.cs.

◆ blacklistNode()

static void DLT.Network.NetworkServer.blacklistNode ( string  ip)
static

Adds the speficied node to the blacklist by public IP.

Parameters
ipNode to blacklist.

Definition at line 547 of file NetworkServer.cs.

◆ broadcastData()

static bool DLT.Network.NetworkServer.broadcastData ( char []  types,
ProtocolMessageCode  code,
byte []  data,
byte []  helper_data,
RemoteEndpoint  skipEndpoint = null 
)
static

Sends the given data to all appropriate connected clients.

Parameters
typesTypes of clients to which the data should be sent.
codeType of the protocol message being sent.
dataByte-field of the data, appropriate for the specific code used.
helper_dataOptional, additional data to transmit after data.
skipEndpointIf given, the message will not be sent to this remote endpoint. This prevents echoing the message to the originating node.
Returns
True, if at least one message was sent to at least one client.

Definition at line 234 of file NetworkServer.cs.

◆ broadcastEventData()

static bool DLT.Network.NetworkServer.broadcastEventData ( NetworkEvents.Type  type,
ProtocolMessageCode  code,
byte []  data,
byte []  address,
byte []  helper_data,
RemoteEndpoint  skipEndpoint = null 
)
static

Sends the specified event to all connected clients. The information is only sent to those clients who have previously subscribed to this event type

Parameters
typeTypes of the event that has occurred.
codeType of the protocol message being sent.
dataByte-field of the data, appropriate for the specific code used.
addressIxian Wallet Address which triggered the event
helper_dataOptional, additional data to transmit after data.
skipEndpointIf given, the message will not be sent to this remote endpoint. This prevents echoing the message to the originating node.
Returns
True, if at least one message was sent to at least one client.

Definition at line 283 of file NetworkServer.cs.

◆ forwardMessage()

static bool DLT.Network.NetworkServer.forwardMessage ( byte []  address,
ProtocolMessageCode  code,
byte []  message 
)
static

Sends the specified network message to the given address, if it is known and connected among clients.

Parameters
addressIxian Wallet Address - the recipient of the message
codeType of the network message to send
messageByte-field with the required data, as specified by code.
Returns
True, if the message was delivered.

Definition at line 330 of file NetworkServer.cs.

◆ getClient()

static RemoteEndpoint DLT.Network.NetworkServer.getClient ( int  idx)
static

Gets the client by sequential index.

Parameters
idxSequential index of the client.
Returns
Client at the given index, or null if out of bounds.

Definition at line 520 of file NetworkServer.cs.

◆ getConnectedClients()

static string [] DLT.Network.NetworkServer.getConnectedClients ( bool  useIncomingPort = false)
static

Retrieves all connected remote endpoints as hostnames or IP addresses and optionally ports.

Parameters
useIncomingPortWhether the TCP port information should be included.
Returns
List of connected clients with optional port information.

Definition at line 401 of file NetworkServer.cs.

◆ getQueuedMessageCount()

static int DLT.Network.NetworkServer.getQueuedMessageCount ( )
static

Retrieves the number of queued outgoing messages for all clients.

Returns
Number of messages in all outgoing queues

Definition at line 502 of file NetworkServer.cs.

◆ handleDisconnectedClients()

static void DLT.Network.NetworkServer.handleDisconnectedClients ( )
static

Checks the list of clients and removes the ones who have disconnected since the last check.

Definition at line 128 of file NetworkServer.cs.

◆ isConnectable()

static bool DLT.Network.NetworkServer.isConnectable ( )
static

Returns if the server is proven to be connectable. (Someone has connected to the server successfully within the past 5 minutes.)

Returns
True, if the server is connectable from the Internet.

Definition at line 591 of file NetworkServer.cs.

◆ isNodeBlacklisted()

static bool DLT.Network.NetworkServer.isNodeBlacklisted ( string  ip)
static

Checks if the specified IP is blacklisted.

Parameters
ipIP address to check
Returns
True, if the node is blacklisted.

Definition at line 560 of file NetworkServer.cs.

◆ isRunning()

static bool DLT.Network.NetworkServer.isRunning ( )
static

Checks if the server is running.

Returns
True, if the network server is running and accepting connections.

Definition at line 581 of file NetworkServer.cs.

◆ removeEndpoint()

static bool DLT.Network.NetworkServer.removeEndpoint ( RemoteEndpoint  endpoint)
static

Removes the given endpoint from the connected client list, but does not immediately issue a disconnect message.

Parameters
endpointEndpoint to remove
Returns
True if the endpoint was removed or false if the endpoint was not known.

Definition at line 488 of file NetworkServer.cs.

◆ restartNetworkOperations()

static void DLT.Network.NetworkServer.restartNetworkOperations ( )
static

Restarts the network server.

Definition at line 163 of file NetworkServer.cs.

◆ sendToClient()

static bool DLT.Network.NetworkServer.sendToClient ( string  neighbor,
ProtocolMessageCode  code,
byte []  data,
byte []  helper_data 
)
static

Sends the protocol message to the specified neighbor node, given as a Hostname or IP address and port.

Parameters
neighborIP address or hostname and port for the neighbor.
codeType of the protocol message
dataData required by the protocol message code.
helper_dataOptional, additional data to transmit after data.
Returns
True if the data was sent to the specified neighbor.

Definition at line 374 of file NetworkServer.cs.

◆ stopNetworkOperations()

static void DLT.Network.NetworkServer.stopNetworkOperations ( )
static

Stops listening for new connections and disconnects all connected clients.

Definition at line 95 of file NetworkServer.cs.

Member Data Documentation

◆ connectable

bool DLT.Network.NetworkServer.connectable = true
static

Flag, indicating whether the listening socket is open and accepting connections.

Definition at line 51 of file NetworkServer.cs.

◆ connectedClients

List<RemoteEndpoint> DLT.Network.NetworkServer.connectedClients = new List<RemoteEndpoint>()
static

List of connected clients.

Definition at line 42 of file NetworkServer.cs.

◆ publicIPAddress

string DLT.Network.NetworkServer.publicIPAddress = "127.0.0.1"
static

IP address on which the server will listen. For security reasons this is pre-set to the local loopback address and must be specifically overwritten when starting the server.

Definition at line 34 of file NetworkServer.cs.


The documentation for this class was generated from the following file: