ServerSocket ss = new ServerSocket(14560);
Socket s = ss.accept();
InputStream is = s.getInputStream();
byte[] bys = new byte[1024];
int length = is.read(bys);
String text = new String(bys, 0, length);
System.out.println("text : " + text);
s.close();
ss.close();
s是通过ss获得的(Socket s = ss.accept(); ) , 那关闭的时候为什么不能只关闭ss呢? 我记得IO时关闭源头即可的啊
|
|