public class ConnectionHandler extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
THREAD_NAME |
static int |
UDP_LIMIT |
| Constructor and Description |
|---|
ConnectionHandler(ConnectionHandler parent,
Number160 id,
KeyPair keyPair,
PeerMap peerMap)
Attaches a peer to an existing connection and use existing information
|
ConnectionHandler(int udpPort,
int tcpPort,
Number160 id,
Bindings bindings,
int p2pID,
ConnectionConfiguration configuration,
File messageLogger,
KeyPair keyPair,
PeerMap peerMap,
List<PeerListener> listeners) |
| Modifier and Type | Method and Description |
|---|---|
void |
customLoggerMessage(String customMessage) |
ConnectionBean |
getConnectionBean() |
PeerBean |
getPeerBean()
Returns the node information bean of this node
|
boolean |
isListening() |
void |
mapUPNP(InetAddress internalAddress,
int internalPortUDP,
int internalPortTCP,
InetAddress externalAddress,
int externalPortUDP,
int externalPortTCP)
Adds a port forearding policy to UPNP enabled devices.
|
void |
shutdown()
Shuts down the dispatcher and frees resources
Note: does not close any channels, use shutdownSharedTCP or
shutdownSharedUDP instead. |
boolean |
startupTCP(InetSocketAddress listenAddressesTCP,
DispatcherRequest dispatcher,
int maxMessageSize)
Creates TCP channels and listens on them
|
boolean |
startupUDP(InetSocketAddress listenAddressesUDP,
DispatcherRequest dispatcher) |
void |
unmapUPNP() |
public static final int UDP_LIMIT
public static final String THREAD_NAME
public ConnectionHandler(int udpPort,
int tcpPort,
Number160 id,
Bindings bindings,
int p2pID,
ConnectionConfiguration configuration,
File messageLogger,
KeyPair keyPair,
PeerMap peerMap,
List<PeerListener> listeners)
throws Exception
Exceptionpublic ConnectionHandler(ConnectionHandler parent, Number160 id, KeyPair keyPair, PeerMap peerMap)
parent - id - public ConnectionBean getConnectionBean()
public boolean startupUDP(InetSocketAddress listenAddressesUDP, DispatcherRequest dispatcher) throws Exception
Exceptionpublic boolean startupTCP(InetSocketAddress listenAddressesTCP, DispatcherRequest dispatcher, int maxMessageSize) throws Exception
listenAddressesTCP - the addresses which we will listen onExceptionpublic PeerBean getPeerBean()
public void customLoggerMessage(String customMessage)
public void shutdown()
shutdownSharedTCP or
shutdownSharedUDP instead.InterruptedExceptionpublic void unmapUPNP()
public void mapUPNP(InetAddress internalAddress, int internalPortUDP, int internalPortTCP, InetAddress externalAddress, int externalPortUDP, int externalPortTCP) throws IOException, UPNPResponseException
internalAddress - internalPortUDP - internalPortTCP - externalAddress - externalPortUDP - externalPortTCP - IOExceptionUPNPResponseExceptionpublic boolean isListening()
Copyright © 2011. All Rights Reserved.