p809 비타민퀴즈 "더 완벽한 서버 프로그램 만들기"
여기서 정답을 보면
"서버 프로그램에 종료 명령이 입력되기를 기다리는 스레드를 추가하면 됩니다"
라고 나오는데 직접 작성해서 마무리 지어보려고 했으나 잘 이해가 가지 않네요^^:;
어떤식으로 스레드를 추가해야 하는지 알려주세요~
멀티 채팅프로그램 넘..... @_@;;
import java.net.*;
class ServerExample4 {
public static void main (String[] args) {
ServerSocket serverSocket = null;
try {
serverSocket = new ServerSocket(9002);
while(true) {
Socket socket = serverSocket.accept();
Thread thread = new PerClientThread(socket);
thread.start();
}
}
catch (Exception e) {
System.out.println(e.getMessage());
}
}
}