public class Connection extends Object implements Serializable
NetworkConnection
encapsulates the properties associated with a connection to a TCP/IP network.
The network connection describes one TCP port on one network device. This can be used for a TCP connection over which a DICOM association can be negotiated with one or more Network AEs. It specifies 8 the hostname and TCP port number. A network connection may support multiple Network AEs. The Network AE selection takes place during association negotiation based on the called and calling AE-titles.
| 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 org.slf4j.Logger |
LOG |
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() |
int |
getAcceptTimeout() |
int |
getBacklog() |
String[] |
getBlacklist()
Get a list of IP addresses from which we should ignore connections.
|
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() |
Listener |
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 |
isServer() |
boolean |
isTcpNoDelay()
Determine if this network connection is using Nagle's algorithm as part
of its network communication.
|
boolean |
isTls() |
boolean |
isTlsNeedClientAuth() |
StringBuilder |
promptTo(StringBuilder sb,
String indent) |
static TCPProtocolHandler |
registerTCPProtocolHandler(Connection.Protocol protocol,
TCPProtocolHandler handler) |
static UDPProtocolHandler |
registerUDPProtocolHandler(Connection.Protocol protocol,
UDPProtocolHandler handler) |
void |
setAcceptTimeout(int timeout) |
void |
setBacklog(int backlog) |
void |
setBlacklist(String[] blacklist)
Set a list of IP addresses from which we should ignore connections.
|
void |
setCommonName(String name)
An arbitrary name for the Network Connections object.
|
void |
setConnectTimeout(int timeout) |
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 |
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 |
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 |
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 TCPProtocolHandler |
unregisterTCPProtocolHandler(Connection.Protocol protocol) |
static UDPProtocolHandler |
unregisterUDPProtocolHandler(Connection.Protocol protocol) |
boolean |
useHttpProxy() |
public static final org.slf4j.Logger LOG
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 TCPProtocolHandler registerTCPProtocolHandler(Connection.Protocol protocol, TCPProtocolHandler handler)
public static TCPProtocolHandler unregisterTCPProtocolHandler(Connection.Protocol protocol)
public static UDPProtocolHandler registerUDPProtocolHandler(Connection.Protocol protocol, UDPProtocolHandler handler)
public static UDPProtocolHandler unregisterUDPProtocolHandler(Connection.Protocol protocol)
public final Device getDevice()
Device object that this Network Connection belongs
to.public final String getHostname()
public final void setHostname(String hostname)
hostname - A String containing the host name.public Connection.Protocol getProtocol()
public void setProtocol(Connection.Protocol protocol)
public final String getCommonName()
public final void setCommonName(String name)
name - A String containing the name.public final int getPort()
-1 for a
network connection that only initiates associations.-1.public final void setPort(int port)
0 for a
network connection that only initiates associations.
A valid port value is between 0 and 65535.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()
An - int value containing the milliseconds.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 void setResponseTimeout(int timeout)
public final int getResponseTimeout()
public final int getRetrieveTimeout()
public final void setRetrieveTimeout(int timeout)
public final int getIdleTimeout()
public final void setIdleTimeout(int idleTimeout)
public String[] getTlsCipherSuites()
public void setTlsCipherSuites(String... tlsCipherSuites)
tlsCipherSuite - 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)
bufferSize - An int value containing the buffer size in KB.public final int getSendBufferSize()
public final void setSendBufferSize(int size)
bufferSize - 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.GeneralSecurityExceptionpublic 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 setReceiveBufferSize(DatagramSocket ds) throws SocketException
SocketExceptionpublic InetSocketAddress getEndPoint() throws UnknownHostException
UnknownHostExceptionpublic boolean bind()
throws IOException,
GeneralSecurityException
IOException - If there is a problem with the network interaction.GeneralSecurityExceptionpublic final boolean isListening()
public boolean isBlackListed(InetAddress ia)
public void unbind()
public Socket connect(Connection remoteConn) throws IOException, IncompatibleConnectionException, GeneralSecurityException
public DatagramSocket createDatagramSocket() throws IOException
IOExceptionpublic Listener getListener()
public void close(Socket s)
public boolean isCompatible(Connection remoteConn)
Copyright © 2014 dcm4che.org. All Rights Reserved.