Page 870 - 3-2
P. 870
//v.clear();
System.out.println(" 클라이언트 종료");
button1.setBackground(Color.gray);
}
System.out.println("v.size =" + v.size());
}
}
};
timer.schedule(timeTask, 0,5000);
Sedong.contentPane.updateUI();
Sedong.contentPane.repaint();
try {
InetAddress local = InetAddress.getLocalHost();
String ip = local.getHostAddress();
System.out.println("main");
serv = new ServerSocket(7777); // 포트넘버 7777
while (true) {
sock = serv.accept();
v.clear();
cli=1;
System.out.println(" 연결");
ServerThread client = new ServerThread(this, sock);
v.addElement(client);
client.start();
}
} catch (Exception e) {
System.out.println(e.toString());
}
}
public static void sendAll(String msg) {
for (int i = 0; i < v.size(); i++) {
ServerThread client = (ServerThread)v.get(i);
client.sendMsg(msg);
//System.out.println(msg+ " 수신");
}
}
public static void main(String args[]) {
Sedong sd = new Sedong();
//System.out.println("main");
//jframe.setVisible(true);
- 870 -