Android TCP读取几行
Android TCP Socket 客户端是否会再读取一行响应?
inputStreamReader = new InputStreamReader(socket.getInputStream());
bufferedReader = new BufferedReader(inputStreamReader);
response = bufferedReader.readLine();
response = bufferedReader.readLine();
Log.i(TAG, "Response :: " + response);
我无法阅读两行。因为我的服务器会响应 200 确定\n 内容......
并且内容每秒都会流式传输到客户端,我不想每次都连接套接字。 sbd可以帮忙吗?
Does Android TCP Socket Client read one more line the response??
inputStreamReader = new InputStreamReader(socket.getInputStream());
bufferedReader = new BufferedReader(inputStreamReader);
response = bufferedReader.readLine();
response = bufferedReader.readLine();
Log.i(TAG, "Response :: " + response);
I cannot read two line. Because my server will response
200 OK \n
Content.......
And the content will stream to the client every seconds, I don't wanna connect the socket every times. Can sbd help??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一个将继续读取直到找到空新行的示例:
An example that will continue to read until an empty new line is found: