IoT CAS Frameworks/IOT_Server/Multi-point_Event_Router_Framework/TCP_Event_Receiver/source/TCPEventReceiver/src/com/prokosha/tcp/eventlistener/EventReceiver.java
public void startListener() {
        SSLSocket skt = null;
        InputStreamReader in = null;
        BufferedReader br = null;
        SSLServerSocket srvr = null;

        try {
            int serverPort = Integer.parseInt(eventReceiverPort);
            log.info("Server Port : " + serverPort);

            SSLServerSocketFactory sslserversocketfactory = (SSLServerSocketFactory) SSLServerSocketFactory.getDefault();
            srvr = (SSLServerSocket) sslserversocketfactory.createServerSocket(serverPort);
            int i = 0;
            TimerTask t = null;
            //Timer timer = null;
            timer = new Timer();
            while (true) {
                try {
                    skt = (SSLSocket) srvr.accept();
                    t = new EchoClient(skt, i++);
                    //timer.schedule(t, 2000 + i, 500);
                    timer.schedule(t, 50 + i, 500);
                } catch (Exception eee) {
                    eee.printStackTrace();
                }
            }
        } catch (Exception e) {
            log.error("Whoops! Error setting server socket\n");
            e.printStackTrace();
            try {
                br.close();
                in.close();
                skt.close();
                srvr.close();
                br = null;
                in = null;
                skt = null;
                srvr = null;
            } catch (Exception ex) {
                e.printStackTrace();
                br = null;
                in = null;
                skt = null;
                srvr = null;
            }
        }
    }
/**
     * call this method to recieve event data and send these to events to
     * corressponding hosts according to configuration.
     */
call this method to recieve event data and send these to events to
corressponding hosts according to configuration.
call this method to recieve event data and send these to events to corressponding hosts according to configuration .
public void startListener() {
        SSLSocket skt = null;
        InputStreamReader in = null;
        BufferedReader br = null;
        SSLServerSocket srvr = null;
        try {
            int serverPort = Integer.parseInt(eventReceiverPort);
            log.info("Server Port : " + serverPort);
            SSLServerSocketFactory sslserversocketfactory = (SSLServerSocketFactory) SSLServerSocketFactory.getDefault();
            srvr = (SSLServerSocket) sslserversocketfactory.createServerSocket(serverPort);
            int i = 0;
            TimerTask t = null;
            timer = new Timer();
            while (true) {
                try {
                    skt = (SSLSocket) srvr.accept();
                    t = new EchoClient(skt, i++);
                    timer.schedule(t, 50 + i, 500);
                } catch (Exception eee) {
                    eee.printStackTrace();
                }
            }
        } catch (Exception e) {
            log.error("Whoops! Error setting server socket\n");
            e.printStackTrace();
            try {
                br.close();
                in.close();
                skt.close();
                srvr.close();
                br = null;
                in = null;
                skt = null;
                srvr = null;
            } catch (Exception ex) {
                e.printStackTrace();
                br = null;
                in = null;
                skt = null;
                srvr = null;
            }
        }
    }
public void startListener ( ) { SSLSocket skt = null ; InputStreamReader in = null ; BufferedReader br = null ; SSLServerSocket srvr = null ; try { int serverPort = Integer . parseInt ( eventReceiverPort ) ; log . info ( "Server Port : " + serverPort ) ; SSLServerSocketFactory sslserversocketfactory = ( SSLServerSocketFactory ) SSLServerSocketFactory . getDefault ( ) ; srvr = ( SSLServerSocket ) sslserversocketfactory . createServerSocket ( serverPort ) ; int i = 0 ; TimerTask t = null ; timer = new Timer ( ) ; while ( true ) { try { skt = ( SSLSocket ) srvr . accept ( ) ; t = new EchoClient ( skt , i ++ ) ; timer . schedule ( t , 50 + i , 500 ) ; } catch ( Exception eee ) { eee . printStackTrace ( ) ; } } } catch ( Exception e ) { log . error ( "Whoops! Error setting server socket\n" ) ; e . printStackTrace ( ) ; try { br . close ( ) ; in . close ( ) ; skt . close ( ) ; srvr . close ( ) ; br = null ; in = null ; skt = null ; srvr = null ; } catch ( Exception ex ) { e . printStackTrace ( ) ; br = null ; in = null ; skt = null ; srvr = null ; } } }
call this method to recieve event data and send these to events to
 corressponding hosts according to configuration.
call this method to recieve event data and send these to events to corressponding hosts according to configuration .
//Timer timer = null; //timer.schedule(t, 2000 + i, 500);