nguyenbahuong / smslib

Automatically exported from code.google.com/p/smslib
0 stars 0 forks source link

port owned by smslib : PortInUseException----help me #517

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I am not able to stop the service after sending first message,getting PortIn 
UseException

Service.java

public synchronized void stopService() throws SMSLibException, 
TimeoutException, GatewayException, IOException, InterruptedException {
         setServiceStatus(ServiceStatus.STOPPING);
        if (getQueueManager() != null) {
            getQueueManager().stop();
        }
        if (getWatchDog() != null) {
            getWatchDog().cancel();
            setWatchDog(null);
        }
        for (AGateway gateway : getGateways()) {
            gateway.stopGateway();

        }
        getNotifyQueueManager().cancel();
        setServiceStatus(ServiceStatus.STOPPED);

        if (getServiceStatus() != ServiceStatus.STOPPED) {
            System.out.println("Service Stopped");
        } else {
            System.out.println("Service Not stopped");
        }
    }

sendsms.java

               SendMessage gsmModem = new SendMessage();
               gsmModem.doIt(port, bitRate, modemName, modemPin, SMSC);

              OutboundMessage msg = new OutboundMessage(mobile Number, "Hello from SMSLib!");
        Service.getInstance().sendMessage(msg);
        System.out.println(msg);

        //System.out.println("Now Sleeping - Hit <enter> to terminate.");
        //System.in.read();
        Service.getInstance().stopService();

Original issue reported on code.google.com by ntn.deve...@gmail.com on 19 Oct 2012 at 8:56

GoogleCodeExporter commented 9 years ago
getting output

===============================================================================

Service Not stopped

Original comment by ntn.deve...@gmail.com on 19 Oct 2012 at 9:43

GoogleCodeExporter commented 9 years ago

Original comment by admin@smslib.org on 11 Nov 2012 at 5:19