Page 862 - 3-2
P. 862

static Vector v;
              static JFrame jframe = new JFrame("Test");
              static JPanel contentPane;
              static JButton button1 = new JButton("reset");
              static JButton button2 = new JButton("sp_on");
              static JButton button3 = new JButton("sp_off");
              static JButton button4 = new JButton("cool_on");
              static JButton button5 = new JButton("cool_off");
              static JButton button6 = new JButton("temp_on");
              static JButton button7 = new JButton("temp_off");
              static JButton button8 = new JButton("senser");
              public ServerMain() {
                      v = new Vector();






                        Timer timer = new Timer();
                            TimerTask timeTask = new TimerTask(){


                                    @Override
                                    public void run() {


                                            if(v.size()>0){


                                            //System.out.println("cli= " + cli);
                                            if(cli ==1) cli=0;
                                            else
                                                    {
                                                    v.clear();
                                                    System.out.println(" 클라이언트 종료");
                                                    }


                                    }
                                            //System.out.println("v.size =" + v.size());
                                    }
                            };


                            timer.schedule(timeTask, 0,4000);
                            System.out.println("Timerstart");


                try {
                    InetAddress local = InetAddress.getLocalHost();
                    String ip = local.getHostAddress();






                                                         - 862 -
   857   858   859   860   861   862   863   864   865   866   867