MazWoz / jsmpp

Automatically exported from code.google.com/p/jsmpp
Apache License 2.0
0 stars 0 forks source link

EnquireLink doesnt work only bind is and no message is submitted and after 5 min connection is lost #40

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Run SimpleSubmitExample.java
2. Comment out shortmessagesubmit line
3. Remove unbind line also from the code
4. Dont submit any message for more than 5 min 

What is the expected output? What do you see instead?
We should have connection status as bind and enquirelink should work after
5 sec 

What version of the product are you using? On what operating system?
Tested jsmpp-2.0 and jsmpp-2.0.1  OS opens Suse 
Bind connection was possible  but after 5 min connection was lost .

Please provide any additional information below.
Patch 
First part of the patch is been fixed in recent version of setting
setSoTimeout before PDUReaderWorker().start() is made

  */
    public String connectAndBind(String host, int port,
            BindParameter bindParam, long timeout)
            throws IOException {
        logger.debug("Connect and bind to {} port {}", host, port);
        if (sequence().currentValue() != 1) {
            throw new IOException("Failed connecting");
        }

        conn = connFactory.createConnection(host, port);
        logger.info("Connected");
        conn.setSoTimeout(getEnquireLinkTimer());
        sessionContext.open();
        try {

Second patch is to check for the equireLink is null or not 

private void notifyNoActivity() {
            logger.debug("No activity notified");
            if (enquireLinkSender != null) {
                enquireLinkSender.enquireLink();
            }
        }

Original issue reported on code.google.com by ashwinmo...@gmail.com on 30 Jun 2009 at 11:19