Binding problems: IOException

525 views
Skip to first unread message

Anoop

unread,
Mar 20, 2009, 11:02:42 AM3/20/09
to jsmpp
Hello,
I observed a problem in a scenerio of issuing a bind request
Scenerio is like this:
First we will issue a bind request and then an unbind request
Then after session is unbound, we will try to bind again
Then the following exception is shown:
(java.io.IOException: Failed connecting
at org.jsmpp.session.SMPPSession.connectAndBind(SMPPSession.java:218)
at org.jsmpp.session.SMPPSession.connectAndBind(SMPPSession.java:200)
at com.JSmppTest.bind(JSmppTest.java:87)
at com.JSmppTest.main(JSmppTest.java:42))

This scenerio is very common in pratical situations because
application should be allowed to rebind if the session was broken due
to some reasons.

Please consider this as an very urgent issue.

This might help u:

Code piece used:

for(int i=0;i<2;i++){
bind();

unbind();

}
While issuing the 2nd bind request, the currentValue() in
connectandBind() (SMPPSession.java) is 3. So this IOException will be
thrown...
Can i know why this exception is thrown)

Hoping for a quick reply


Anoop

Shantanu Kumar

unread,
Mar 20, 2009, 11:18:27 AM3/20/09
to js...@googlegroups.com
I was facing a similar issue, but as it turns out you can bind once
again after you have instantiated a new SMPPSession object. Below is
just an example code:

jsmppSession.unbindAndClose();
jsmppSession = new SMPPSession();
JsmppUtil.bindTransmitter(jsmppSession, jsmppBindParams);

HTH

Thanks,
Shantanu

uud ashr

unread,
Mar 22, 2009, 9:46:20 AM3/22/09
to js...@googlegroups.com
Hi, 

If the connection is unbound or closed, then you will reconnect/rebound with different session. It similar like you create new SMPPSession (SMPPSession is a session).
So a single SMPPSession lifecycle is CLOSED, OPEN, BOUND, UNBOUND, CLOSED there is no way back to make it OPEN after you CLOSE after UNBOUND the session, so you should create new session to make it happen.

Best regards, 
uudashr

Etienne Swanepoel

unread,
Mar 22, 2009, 10:02:42 AM3/22/09
to js...@googlegroups.com
I codded over the weekend......it seems that this problem only occurs
when a messagelister is added to the session..was this tested on a
very slow Internet connection?the examples
AsyncSubmitReceiveDeliverSmExample failes after sending out like 10
messages and then waiting for the dileveryreports..

org.jsmpp.extra.ResponseTimeoutException: No response after waiting
for 50000 millis when executing submit_sm with sessionId 0858f766 and
sequenceNumber 26
at org.jsmpp.session.AbstractSession.executeSendCommand(AbstractSession.java:261)
at org.jsmpp.session.SMPPSession.submitShortMessage(SMPPSession.java:318)
at org.sakaiproject.sms.logic.smpp.test.SmppAPITest.main(SmppAPITest.java:111)
Caused by: org.jsmpp.extra.ResponseTimeoutException: No response after
50000 millis
at org.jsmpp.extra.PendingResponse.waitDone(PendingResponse.java:117)
at org.jsmpp.session.AbstractSession.executeSendCommand(AbstractSession.java:257)
... 2 more
ERROR [main] (AbstractSession.java:250) - Failed sending submit_sm command
java.net.SocketException: Socket closed
at java.net.SocketOutputStream.socketWrite(Unknown Source)
at java.net.SocketOutputStream.write(Unknown Source)
at org.jsmpp.DefaultPDUSender.writeAndFlush(DefaultPDUSender.java:419)
at org.jsmpp.DefaultPDUSender.sendSubmitSm(DefaultPDUSender.java:203)
at org.jsmpp.SynchronizedPDUSender.sendSubmitSm(SynchronizedPDUSender.java:192)
at org.jsmpp.session.SubmitSmCommandTask.executeTask(SubmitSmCommandTask.java:86)
at org.jsmpp.session.AbstractSession.executeSendCommand(AbstractSession.java:248)
at org.jsmpp.session.SMPPSession.submitShortMessage(SMPPSession.java:318)
at org.sakaiproject.sms.logic.smpp.test.SmppAPITest.main(SmppAPITest.java:111)
16 [main] ERROR org.jsmpp.session.AbstractSession - Failed sending
submit_sm command
java.net.SocketException: Socket closed
at java.net.SocketOutputStream.socketWrite(Unknown Source)



its almost like the messgelistener locks the connection and then
nothing can communicate on the session?....sinch this is a stock
example i cannot be crazy hehehe........any further helpys would be
kickass....

uud ashr

unread,
Mar 23, 2009, 5:26:17 AM3/23/09
to js...@googlegroups.com
Hmm, but it seems that your connection is closed?

Shantanu Kumar

unread,
Mar 23, 2009, 5:30:47 AM3/23/09
to js...@googlegroups.com
Keep re-trying until the connection is made. :-) Or, maintain a
maximum duration until you give up re-trying.

It may be the SMSC (or the SMPP gateway) which is unable to accept
connections immediately. In an application I am testing, a reconnect
takes anywhere between 1 retry to 1000.

Thanks,
Shantanu
Reply all
Reply to author
Forward
0 new messages