0
class Server
{
while(true)
new ClientThread(Socket.accept()).start();
}
class ClientThread extends Thread
{
public void run()
{
ppl.chat(Socket s);//a defined protocol object in my program
}
}
class Protocol
{
public Protocol(Socket s)
{
socket=s;
}
public synchronized void chat()
{
//here i defined socket input output streams and serverinput is a string given by server
if(ServerInput=="wait")
wait();
if(ServerInput=="cont")
notify()
.....................sending infomation-------
}
}
여기에서 나는이 소켓을 통해 정보를 보낼 수없는 후 wait()
블록에서 벗어날 수 있습니다. 테스트가 성공적으로 대기 블록에서 나왔습니다. 다른 클라이언트 스레드에서 "계속"을 제공하여 알림을받을 때. 누구든지 내 문제를 해결합니까? 진심으로 감사드립니다.상황에 따라 클라이언트 스레드를 깨우는 방법?