我是这么用的t=serversocket(inetaddress,2);
while(true){
t=y.accept();
out=new PrintWriter(new BufferedWriter(new OutputStreamWriter(t.getOutputStream())),true);
in=new BufferedReader(new InputStreamReader(t.getInputStream()));
System.out.println(in.readLine());
}
}catch(IOException x){x.printStackTrace();}
客户端:
try{
Socket x=new Socket(InetAddress.getLocalHost(),4113);
out=new PrintWriter(new BufferedWriter(new OutputStreamWriter(x.getOutputStream())),true);
in=new BufferedReader(new InputStreamReader(x.getInputStream()));
}catch(IOException e){e.printStackTrace();}
System.out.println("x");
try{
out.println(System.in.read());
}
启动服务端之后,同时启动3个客户端,顺序为A,B,C
我在C客户端输入a,然后在B客户端输入B,然后在A客户端输入C。这下问题出来了!!服务端只输出一个99然后退出了??
想知道这是怎么回事?A,B客户端的数据怎么没有输出??请教了!!
[此贴子已经被作者于2007-9-25 14:53:38编辑过]