Page 869 - 3-2
P. 869
static JButton button1 = new JButton("reset");
static JButton buttons[] = new JButton[1000];
static String spark,gas;
static int fire;
static float temp;
static int sparknum,gasnum,tempnum,firenum;
static final String JDBC_DRIVER = "com.mysql.jdbc.Driver";
static final String DB_URL =
"jdbc:mysql://localhost:3306/and1?autoReconnect=true&useSSL=false";
static final String USERNAME = "root";
static final String PASSWORD = "raspberry";
public ServerMain() {
jframe.setVisible(true);
//sd.setVisible(true);
System.out.println("start");
v = new Vector();
Place pla = new Place();
Timer timer0 = new Timer(); //5 초에 한번 클라이언트 접속을 확인.
TimerTask timeTask0 = new TimerTask(){
@Override
public void run() {
sendAll("reset");
}
};
timer0.schedule(timeTask0, 1000,5000);
Timer timer = new Timer(); //5 초에 한번 클라이언트 접속을 확인.
TimerTask timeTask = new TimerTask(){
@Override
public void run() {
if(v.size()>0){ // 접속된 클라이언트가 있다면
System.out.println("cli= " + cli);
if(cli ==1) cli=0;
else
{
- 869 -