org.jsmpp.session
Class SMPPServerSessionListener

java.lang.Object
  extended by 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

Constructor Summary
SMPPServerSessionListener(int port)
           
SMPPServerSessionListener(int port, int timeout, int backlog, ServerConnectionFactory serverConnFactory)
           
SMPPServerSessionListener(int port, int timeout, ServerConnectionFactory serverConnFactory)
           
SMPPServerSessionListener(int port, ServerConnectionFactory serverConnFactory)
           
 
Method Summary
 SMPPServerSession accept()
          Accept session request from client.
 void close()
           
 int getInitiationTimer()
           
 ServerMessageReceiverListener getMessageReceiverListener()
           
 int getPduProcessorDegree()
           
 int getPort()
           
 SessionStateListener getSessionStateListener()
           
 int getTimeout(int timeout)
           
 void setInitiationTimer(int initiationTimer)
           
 void setMessageReceiverListener(ServerMessageReceiverListener messageReceiverListener)
           
 void setPduProcessorDegree(int pduProcessorDegree)
           
 void setResponseDeliveryListener(ServerResponseDeliveryListener responseDeliveryListener)
           
 void setSessionStateListener(SessionStateListener sessionStateListener)
           
 void setTimeout(int timeout)
          Timeout listening.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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
Method Detail

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