public class TSAP
extends java.lang.Object
| Constructor and Description |
|---|
TSAP()
Use this constructor to create a client SML_TSAP that can be used to start a connection to a remote SML server.
|
TSAP(int port,
TConnectionListener conListener)
Use this constructor to create a server TSAP that can listen on a port.
|
TSAP(int port,
TConnectionListener conListener,
javax.net.ServerSocketFactory serverSocketFactory)
Use this constructor to create a server TSAP that can listen on a port, with a specified ServerSocketFactory.
|
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 |
|---|---|
TConnection |
connectTo(java.net.InetAddress address,
int port,
int timeout)
Connect to a remote TSAP that is listening at the destination address.
|
protected 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 TSAP()
public TSAP(javax.net.SocketFactory socketFactory)
socketFactory - the socket factorypublic TSAP(int port,
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 TSAP(int port,
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 - if an error occurs starting to listen on server portpublic void stopListening()
public void setMaxConnections(int maxConnections)
maxConnections - the number of connections allowed (default is 100)public void setMessageTimeout(int messageTimeout)
messageTimeout - in millisecondspublic void setMessageFragmentTimeout(int messageFragmentTimeout)
messageFragmentTimeout - in millisecondsprotected TConnectionListener getConnectionListener()
public TConnection connectTo(java.net.InetAddress address, int port, int timeout) throws java.io.IOException
address - remote InetAddressport - remote porttimeout - timeoutjava.io.IOException - if connection was unsuccessful.