Page 867 - 3-2
P. 867
public void run() { // 클라이언트에서 데이터 받음
String str;
System.out.println("run!");
try {
while (true) {
str = din.readUTF();
if(str.equals("acc")) {
sendMsg("acc");
srv.cli = 1;
}
else System.out.println(" 클라이언트에게 받음: " + str);
}
} catch(SocketException e){
}catch(EOFException e){
}catch (Exception e) {
System.out.println(e.toString()+ "333");
e.printStackTrace();
// srv.v.clear();
}
}
}
// 중앙모니터에서 데이터베이스로 정보를 관리
/*
* 클래스: ServerMain
* 필드: serv(ServerSocket), sock(Socket)
* 생성자: ServerMain()
* 메소드: maker(): 감지기 갯수만큼 버튼을 만들어주는 메소드
* spark(): 불꽃센서에서 감지된 값을 데이터베이스로 보내주는 메소드
* gas(): 가스센서에서 감지된 값을 데이터베이스로 보내주는 메소드
* temp(): 온도센서에서 감지된 값을 데이터베이스로 보내주는 메소드
* 클라이언트가 접속됐는지 확인 클라이언트에 명령을 보내는 클래스,
*/
- 867 -