无法向客户端写入数据,写入时提示连接已中断。大佬帮忙看下
ServerSocket s = new ServerSocket(80);
Socket ss = s.accept();
OutputStream os = null;
InputStream inputStream = null;
BufferedReader in = null;
inputStream = ss.getInputStream();
os = ss.getOutputStream();
in = new BufferedReader(new InputStreamReader(inputStream));
String str = "";
String read = "";
read = in.readLine();
while (str != null){
try {
str = in.readLine();
} catch (IOException e) {}
read += str + "\n";
}
System.out.print(read);
os.write("Hello world!".getBytes());