public class Connection extends Object implements Serializable
| Modifier and Type | Class and Description |
|---|---|
static class |
Connection.Protocol |
| Modifier and Type | Field and Description |
|---|---|
static int |
DEF_BACKLOG |
static int |
DEF_BUFFERSIZE |
static int |
DEF_MAX_PDU_LENGTH |
static int |
DEF_SOCKETDELAY |
static String[] |
DEFAULT_TLS_PROTOCOLS |
static int |
NO_TIMEOUT |
static int |
NOT_LISTENING |
static int |
SYNCHRONOUS_MODE |
static String |
TLS_RSA_WITH_3DES_EDE_CBC_SHA |
static String |
TLS_RSA_WITH_AES_128_CBC_SHA |
static String |
TLS_RSA_WITH_NULL_SHA |
| Constructor and Description |
|---|
Connection() |
Connection(String commonName,
String hostname) |
Connection(String commonName,
String hostname,
int port) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
bind()
Bind this network connection to a TCP port and start a server socket
accept loop.
|
void |
close(Socket s) |
Socket |
connect(Connection remoteConn) |
DatagramSocket |
createDatagramSocket() |
boolean |
equalsRDN(Connection other) |
int |
getAcceptTimeout() |
int |
getBacklog() |
String |
getBindAddress()
Bind address of listening socket or
null. |
InetSocketAddress |
getBindPoint() |
String[] |
getBlacklist()
Get a list of IP addresses from which we should ignore connections.
|
String |
getClientBindAddress()
Bind address of outgoing connections,
"0.0.0.0" or null. |
InetSocketAddress |
getClientBindPoint() |
String |
getCommonName()
An arbitrary name for the Network Connections object.
|
int |
getConnectTimeout() |
Device |
getDevice()
Get the Device object that this Network Connection belongs
to.
|
InetSocketAddress |
getEndPoint() |
String |
getHostname()
This is the DNS name for this particular connection.
|
String |
getHttpProxy() |
int |
getIdleTimeout() |
Boolean |
getInstalled() |
SocketListener |
getListener() |
int |
getMaxOpsInvoked() |
int |
getMaxOpsPerformed() |
int |
getPort()
The TCP port that the AE is listening on or -1 for a
network connection that only initiates associations.
|
Connection.Protocol |
getProtocol() |
int |
getReceiveBufferSize()
Get the SO_RCVBUF socket value in KB.
|
int |
getReceivePDULength() |
int |
getReleaseTimeout()
Timeout in ms for receiving A-RELEASE-RP, 5000 by default.
|
int |
getRequestTimeout()
Timeout in ms for receiving A-ASSOCIATE-RQ, 5000 by default
|
int |
getResponseTimeout() |
int |
getRetrieveTimeout() |
int |
getSendBufferSize()
Get the SO_SNDBUF socket option value in KB,
|
int |
getSendPDULength() |
int |
getSocketCloseDelay()
Delay in ms for Socket close after sending A-ABORT, 50ms by default.
|
String[] |
getTlsCipherSuites()
The TLS CipherSuites that are supported on this particular connection.
|
String[] |
getTlsProtocols() |
boolean |
isBlackListed(InetAddress ia) |
boolean |
isCompatible(Connection remoteConn) |
boolean |
isInstalled()
True if the Network Connection is installed on the network.
|
boolean |
isListening() |
boolean |
isPackPDV() |
boolean |
isRebindNeeded() |
boolean |
isRetrieveTimeoutTotal() |
boolean |
isServer() |
boolean |
isTcpNoDelay()
Determine if this network connection is using Nagle's algorithm as part
of its network communication.
|
boolean |
isTls() |
boolean |
isTlsNeedClientAuth() |
void |
needRebind() |
StringBuilder |
promptTo(StringBuilder sb,
String indent) |
void |
rebind() |
void |
reconfigure(Connection from) |
static TCPHandler |
registerTCPProtocolHandler(Connection.Protocol protocol,
TCPHandler handler) |
static UDPHandler |
registerUDPProtocolHandler(Connection.Protocol protocol,
UDPHandler handler) |
void |
setAcceptTimeout(int timeout) |
void |
setBacklog(int backlog) |
void |
setBindAddress(String bindAddress)
Bind address of listening socket or
null. |
void |
setBlacklist(String[] blacklist)
Set a list of IP addresses from which we should ignore connections.
|
void |
setClientBindAddress(String bindAddress)
Bind address of outgoing connections,
"0.0.0.0" or null. |
void |
setCommonName(String name)
An arbitrary name for the Network Connections object.
|
void |
setConnectTimeout(int timeout) |
void |
setDevice(Device device)
Set the Device object that this Network Connection belongs
to.
|
void |
setHostname(String hostname)
This is the DNS name for this particular connection.
|
void |
setHttpProxy(String proxy) |
void |
setIdleTimeout(int idleTimeout) |
void |
setInstalled(Boolean installed)
True if the Network Connection is installed on the network.
|
void |
setMaxOpsInvoked(int maxOpsInvoked) |
void |
setMaxOpsPerformed(int maxOpsPerformed) |
void |
setPackPDV(boolean packPDV) |
void |
setPort(int port)
The TCP port that the AE is listening on or 0 for a
network connection that only initiates associations.
|
void |
setProtocol(Connection.Protocol protocol) |
void |
setReceiveBufferSize(DatagramSocket ds) |
void |
setReceiveBufferSize(int size)
Set the SO_RCVBUF socket option to specified value in KB.
|
void |
setReceiveBufferSize(ServerSocket ss) |
void |
setReceivePDULength(int receivePDULength) |
void |
setReleaseTimeout(int timeout)
Timeout in ms for receiving A-RELEASE-RP, 5000 by default.
|
void |
setRequestTimeout(int timeout)
Timeout in ms for receiving A-ASSOCIATE-RQ, 5000 by default
|
void |
setResponseTimeout(int timeout) |
void |
setRetrieveTimeout(int timeout) |
void |
setRetrieveTimeoutTotal(boolean retrieveTimeoutTotal) |
void |
setSendBufferSize(int size)
Set the SO_SNDBUF socket option to specified value in KB,
|
void |
setSendPDULength(int sendPDULength) |
void |
setSocketCloseDelay(int delay)
Delay in ms for Socket close after sending A-ABORT, 50ms by default.
|
void |
setSocketSendOptions(Socket s) |
void |
setTcpNoDelay(boolean tcpNoDelay)
Set whether or not this network connection should use Nagle's algorithm
as part of its network communication.
|
void |
setTlsCipherSuites(String... tlsCipherSuites)
The TLS CipherSuites that are supported on this particular connection.
|
void |
setTlsNeedClientAuth(boolean tlsNeedClientAuth) |
void |
setTlsProtocols(String... tlsProtocols) |
String |
toString() |
void |
unbind() |
static TCPHandler |
unregisterTCPProtocolHandler(Connection.Protocol protocol) |
static UDPHandler |
unregisterUDPProtocolHandler(Connection.Protocol protocol) |
boolean |
useHttpProxy() |
public static final int NO_TIMEOUT
public static final int SYNCHRONOUS_MODE
public static final int NOT_LISTENING
public static final int DEF_BACKLOG
public static final int DEF_SOCKETDELAY
public static final int DEF_BUFFERSIZE
public static final int DEF_MAX_PDU_LENGTH
public static final String TLS_RSA_WITH_NULL_SHA
public static final String TLS_RSA_WITH_3DES_EDE_CBC_SHA
public static final String TLS_RSA_WITH_AES_128_CBC_SHA
public static final String[] DEFAULT_TLS_PROTOCOLS
public static TCPHandler registerTCPProtocolHandler(Connection.Protocol protocol, TCPHandler handler)
public static TCPHandler unregisterTCPProtocolHandler(Connection.Protocol protocol)
public static UDPHandler registerUDPProtocolHandler(Connection.Protocol protocol, UDPHandler handler)
public static UDPHandler unregisterUDPProtocolHandler(Connection.Protocol protocol)
public final Device getDevice()
public final void setDevice(Device device)
device - The owning Device object.public final String getHostname()
public final void setHostname(String hostname)
hostname - A String containing the host name.public final String getBindAddress()
null. If null, bind
listening socket to getHostname(). This is the default.nullpublic final void setBindAddress(String bindAddress)
bindAddress - Bind address of listening socket or nullpublic String getClientBindAddress()
"0.0.0.0" or null.
If "0.0.0.0" the system pick up any local ip for outgoing
connections. If null, bind outgoing connections to
getHostname(). This is the default.public void setClientBindAddress(String bindAddress)
"0.0.0.0" or null.
If "0.0.0.0" the system pick up any local ip for outgoing
connections. If null, bind outgoing connections to
getHostname().bindAddress - Bind address of outgoing connection or nullpublic Connection.Protocol getProtocol()
public void setProtocol(Connection.Protocol protocol)
public boolean isRebindNeeded()
public void needRebind()
public final String getCommonName()
public final void setCommonName(String name)
name - A String containing the name.public final int getPort()
public final void setPort(int port)
port - The port number or -1.public final String getHttpProxy()
public final void setHttpProxy(String proxy)
public final boolean useHttpProxy()
public final boolean isServer()
public final int getBacklog()
public final void setBacklog(int backlog)
public final int getConnectTimeout()
public final void setConnectTimeout(int timeout)
public final int getRequestTimeout()
public final void setRequestTimeout(int timeout)
timeout - An int value containing the milliseconds.public final int getAcceptTimeout()
public final void setAcceptTimeout(int timeout)
public final int getReleaseTimeout()
public final void setReleaseTimeout(int timeout)
timeout - An int value containing the milliseconds.public final int getSocketCloseDelay()
public final void setSocketCloseDelay(int delay)
delay - An int value containing the milliseconds.public final int getResponseTimeout()
public final void setResponseTimeout(int timeout)
public final int getRetrieveTimeout()
public final void setRetrieveTimeout(int timeout)
public final boolean isRetrieveTimeoutTotal()
public final void setRetrieveTimeoutTotal(boolean retrieveTimeoutTotal)
public final int getIdleTimeout()
public final void setIdleTimeout(int idleTimeout)
public String[] getTlsCipherSuites()
public void setTlsCipherSuites(String... tlsCipherSuites)
tlsCipherSuites - A String array containing the supported cipher suitespublic final boolean isTls()
public final String[] getTlsProtocols()
public final void setTlsProtocols(String... tlsProtocols)
public final boolean isTlsNeedClientAuth()
public final void setTlsNeedClientAuth(boolean tlsNeedClientAuth)
public final int getReceiveBufferSize()
public final void setReceiveBufferSize(int size)
size - An int value containing the buffer size in KB.public void setReceiveBufferSize(ServerSocket ss) throws SocketException
SocketExceptionpublic void setReceiveBufferSize(DatagramSocket ds) throws SocketException
SocketExceptionpublic final int getSendBufferSize()
public final void setSendBufferSize(int size)
size - An int value containing the buffer size in KB.public final int getSendPDULength()
public final void setSendPDULength(int sendPDULength)
public final int getReceivePDULength()
public final void setReceivePDULength(int receivePDULength)
public final int getMaxOpsPerformed()
public final void setMaxOpsPerformed(int maxOpsPerformed)
public final int getMaxOpsInvoked()
public final void setMaxOpsInvoked(int maxOpsInvoked)
public final boolean isPackPDV()
public final void setPackPDV(boolean packPDV)
public final boolean isTcpNoDelay()
public final void setTcpNoDelay(boolean tcpNoDelay)
tcpNoDelay - boolean True if TCP no delay (disable Nagle's algorithm)
should be used.public boolean isInstalled()
public Boolean getInstalled()
public void setInstalled(Boolean installed)
installed - True if the NetworkConnection is installed on the network.public void rebind()
throws IOException,
GeneralSecurityException
IOExceptionGeneralSecurityExceptionpublic final String[] getBlacklist()
public final void setBlacklist(String[] blacklist)
blacklist - the list of IP addresses which should be ignored.public StringBuilder promptTo(StringBuilder sb, String indent)
public void setSocketSendOptions(Socket s) throws SocketException
SocketExceptionpublic InetSocketAddress getEndPoint() throws UnknownHostException
UnknownHostExceptionpublic InetSocketAddress getBindPoint() throws UnknownHostException
UnknownHostExceptionpublic InetSocketAddress getClientBindPoint() throws UnknownHostException
UnknownHostExceptionpublic boolean bind()
throws IOException,
GeneralSecurityException
IOException - If there is a problem with the network interaction.GeneralSecurityException - exceptionpublic final boolean isListening()
public boolean isBlackListed(InetAddress ia)
public void unbind()
public Socket connect(Connection remoteConn) throws IOException, org.aoju.bus.core.lang.exception.InstrumentException, GeneralSecurityException
IOExceptionorg.aoju.bus.core.lang.exception.InstrumentExceptionGeneralSecurityExceptionpublic DatagramSocket createDatagramSocket() throws IOException
IOExceptionpublic SocketListener getListener()
public void close(Socket s)
public boolean isCompatible(Connection remoteConn)
public boolean equalsRDN(Connection other)
public void reconfigure(Connection from)
Copyright © 2020. All rights reserved.