import java.net.Socket;

  OutputStream out = socket.getOutputStream();
        out.write(toBytes(cmd));
 InputStream in = socket.getInputStream();
        while ((len = in.read(bytes)) != -1) {
            String str = new String(bytes, 0, len, StandardCharsets.UTF_8);
            int sp = str.indexOf('\n');
            if (sp != -1) {
                sb.append(str, 0, sp);
                break;
            }
            sb.append(str);
        }

  

posted on 2020-12-01 23:10  lydstory  阅读(215)  评论(0)    收藏  举报

导航