org.openmuc.jsml.tl
public class SML_TSAP extends java.lang.Object
Constructor and Description |
---|
SML_TSAP()
Use this constructor to create a client SML_TSAP that can be used to
start a connection to a remote SML server.
|
SML_TSAP(int port,
SML_TConnectionListener conListener)
Use this constructor to create a server TSAP that can listen on a port.
|
SML_TSAP(int port,
SML_TConnectionListener conListener,
javax.net.ServerSocketFactory serverSocketFactory)
Use this constructor to create a server TSAP that can listen on a port,
with a specified ServerSocketFactory.
|
SML_TSAP(javax.net.SocketFactory socketFactory)
Use this constructor to create a client SML_TSAP that can be used to
start a connection to a remote SML server.
|
Modifier and Type | Method and Description |
---|---|
SML_TConnection |
connectTo(java.net.InetAddress address,
int port,
int timeout)
Connect to a remote TSAP that is listening at the destination address.
|
protected SML_TConnectionListener |
getConnectionListener() |
void |
setMaxConnections(int maxConnections)
Set the maximum number of connections that are allowed in parallel by the
Server SAP.
|
void |
setMessageFragmentTimeout(int messageFragmentTimeout)
Set the TConnection timeout for receiving data once the beginning of a
message has been received.
|
void |
setMessageTimeout(int messageTimeout)
Set the TConnection timeout for waiting for the first byte of a new
message.
|
void |
startListening()
Starts a new thread that listens on the configured port.
|
void |
stopListening()
Stop listing on the port.
|
public SML_TSAP()
public SML_TSAP(javax.net.SocketFactory socketFactory)
public SML_TSAP(int port, SML_TConnectionListener conListener)
port
- the TCP-port that the ServerSocket will connect to. Should be
between 1 and 65535.conListener
- the ConnectionListener that will be notified when remote TSAPs
are connecting or the server stopped listening.public SML_TSAP(int port, SML_TConnectionListener conListener, javax.net.ServerSocketFactory serverSocketFactory)
port
- the TCP-port that the ServerSocket will connect to. Should be
between 1 and 65535.conListener
- the ConnectionListener that will be notified when remote TSAPs
are connecting or the server stopped listening.serverSocketFactory
- The ServerSocketFactory to be used to create the ServerSocketpublic void startListening() throws java.io.IOException
java.io.IOException
public void stopListening()
public void setMaxConnections(int maxConnections)
maxConnections
- the number of connections allowed (default is 100)public void setMessageTimeout(int messageTimeout) throws java.net.SocketException
messageTimeout
- in millisecondsjava.net.SocketException
public void setMessageFragmentTimeout(int messageFragmentTimeout) throws java.net.SocketException
messageFragmentTimeout
- in millisecondsjava.net.SocketException
protected SML_TConnectionListener getConnectionListener()
public SML_TConnection connectTo(java.net.InetAddress address, int port, int timeout) throws java.io.IOException
address
- remote InetAddressport
- remote portjava.io.IOException
- is thrown if connection was unsuccessful.