org.jsmpp.session
Class SMPPServerSessionListener
java.lang.Object
org.jsmpp.session.SMPPServerSessionListener
public class SMPPServerSessionListener
- extends java.lang.Object
This object responsible to for new SMPP Session request from ESME. It will
listen on specified port.
SMPPServerSession session = listener.accept();
BindRequest bindReq = session.waitForBind(5000);
if (checkPassword(bindReq)) {
bindReq.accept("sys");
} else {
bindReq.reject(SMPPConstant.STAT_ESME_RINVPASWD);
}
The listening trough getting the bind request should take less than session
initiation timer, otherwise if there is network open has been requested, ESME
will close the connection. Accepting the bind request should take less than
transaction timer or ESME will issued timeout.
- Author:
- uudashr
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
port
private final int port
serverConn
private final ServerConnection serverConn
initiationTimer
private int initiationTimer
pduProcessorDegree
private int pduProcessorDegree
sessionStateListener
private SessionStateListener sessionStateListener
messageReceiverListener
private ServerMessageReceiverListener messageReceiverListener
responseDeliveryListener
private ServerResponseDeliveryListener responseDeliveryListener
SMPPServerSessionListener
public SMPPServerSessionListener(int port)
throws java.io.IOException
- Throws:
java.io.IOException
SMPPServerSessionListener
public SMPPServerSessionListener(int port,
ServerConnectionFactory serverConnFactory)
throws java.io.IOException
- Throws:
java.io.IOException
SMPPServerSessionListener
public SMPPServerSessionListener(int port,
int timeout,
ServerConnectionFactory serverConnFactory)
throws java.io.IOException
- Throws:
java.io.IOException
SMPPServerSessionListener
public SMPPServerSessionListener(int port,
int timeout,
int backlog,
ServerConnectionFactory serverConnFactory)
throws java.io.IOException
- Throws:
java.io.IOException
getTimeout
public int getTimeout(int timeout)
throws java.io.IOException
- Throws:
java.io.IOException
setTimeout
public void setTimeout(int timeout)
throws java.io.IOException
- Timeout listening. When timeout reach and connection request didn't
arrive then
SocketTimeoutException
will be thrown but the
listener still valid.
- Parameters:
timeout
-
- Throws:
java.io.IOException
setPduProcessorDegree
public void setPduProcessorDegree(int pduProcessorDegree)
getPduProcessorDegree
public int getPduProcessorDegree()
getPort
public int getPort()
getInitiationTimer
public int getInitiationTimer()
setInitiationTimer
public void setInitiationTimer(int initiationTimer)
getSessionStateListener
public SessionStateListener getSessionStateListener()
setSessionStateListener
public void setSessionStateListener(SessionStateListener sessionStateListener)
getMessageReceiverListener
public ServerMessageReceiverListener getMessageReceiverListener()
setMessageReceiverListener
public void setMessageReceiverListener(ServerMessageReceiverListener messageReceiverListener)
setResponseDeliveryListener
public void setResponseDeliveryListener(ServerResponseDeliveryListener responseDeliveryListener)
accept
public SMPPServerSession accept()
throws java.io.IOException
- Accept session request from client. The session state is still OPEN. To
communicate with ESME properly binding request should be accepted.
SMPPServerSession session = listener.accept();
BindRequest bindReq = session.waitForBind(5000);
if (checkPassword(bindReq)) {
bindReq.accept("sys");
} else {
bindReq.reject(SMPPConstant.STAT_ESME_RINVPASWD);
}
- Returns:
- the accepted
SMPPServerSession
.
- Throws:
java.net.SocketTimeoutException
- if timeout reach with no session accepted.
java.io.IOException
- if there is an IO error occur.- See Also:
SMPPServerSession
,
BindRequest
close
public void close()
throws java.io.IOException
- Throws:
java.io.IOException