public final class NetworkHandler
extends java.lang.Object
implements java.lang.Runnable
Modifier and Type | Field and Description |
---|---|
static int |
peerReadTimeout
Peer read timeout (seconds)
|
static int |
TESTNET_PEER_PORT
Testnet peer port
|
Modifier and Type | Method and Description |
---|---|
static int |
broadcastMessage(NetworkMessage message)
Broadcast a message to all connected peers
|
static int |
broadcastMessage(Peer sender,
NetworkMessage message)
Broadcast a message to all connected peers
|
static int |
getConnectionCount()
Get the connected peer count
|
static int |
getDefaultPeerPort()
Get the default peer port
|
static int |
getInboundCount()
Get the number of inbound connections
|
static int |
getMaxInboundConnections()
Return the maximum number of inbound connections
|
static int |
getMaxOutboundConnections()
Return the maximum number of outbound connections
|
static int |
getOutboundCount()
Get the number of outbound connections
|
static void |
init()
Initialize the network handler
|
static boolean |
isNetworkStarted()
Check if the network has finished initialization
|
void |
run()
Network listener
|
static void |
shutdown()
Shutdown the network handler
|
public static final int TESTNET_PEER_PORT
public static final int peerReadTimeout
public static void init()
public static void shutdown()
public void run()
run
in interface java.lang.Runnable
public static boolean isNetworkStarted()
public static int broadcastMessage(NetworkMessage message)
message
- Message to sendpublic static int broadcastMessage(Peer sender, NetworkMessage message)
sender
- Message sender or null if our messagemessage
- Message to sendpublic static int getDefaultPeerPort()
public static int getConnectionCount()
public static int getInboundCount()
public static int getMaxInboundConnections()
public static int getOutboundCount()
public static int getMaxOutboundConnections()