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 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 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< RemoteEndpoint > | connectedClients = new List<RemoteEndpoint>() |
| List of connected clients. More...
|
|
static bool | connectable = true |
| Flag, indicating whether the listening socket is open and accepting connections. More...
|
|
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.
◆ 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
-
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
-
types | Types of clients to which the data should be sent. |
code | Type of the protocol message being sent. |
data | Byte-field of the data, appropriate for the specific code used. |
helper_data | Optional, additional data to transmit after data . |
skipEndpoint | If 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()
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
-
type | Types of the event that has occurred. |
code | Type of the protocol message being sent. |
data | Byte-field of the data, appropriate for the specific code used. |
address | Ixian Wallet Address which triggered the event |
helper_data | Optional, additional data to transmit after data . |
skipEndpoint | If 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
-
address | Ixian Wallet Address - the recipient of the message |
code | Type of the network message to send |
message | Byte-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()
Gets the client by sequential index.
- Parameters
-
idx | Sequential 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
-
useIncomingPort | Whether 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
-
- 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
-
endpoint | Endpoint 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 |
◆ 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
-
neighbor | IP address or hostname and port for the neighbor. |
code | Type of the protocol message |
data | Data required by the protocol message code . |
helper_data | Optional, 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.
◆ 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
◆ 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: