while (true) { try { Socket s = ss.accept(); //这里的ss是已经初始化好的ServerSocket对象 if (null != s) { BufferedReader in = new BufferedReader (new InputStreamReader (s.getInputStream() ) ); PrintWriter out = new PrintWriter (s.getOutputStream(), true); String ininfo = in.readLine(); System.out.println (info); in.close(); out.close(); s.close(); } } catch (IOException e) { e.printStackTrace(); } }
初级程序员
by: 云代码会员 发表于:2013-04-21 15:06:12 顶(0) | 踩(0) 回复
谢谢分享,学习下
回复评论