我希望从我的 telnet 套接字输入中解析“艺术家 - 标题”。现在它只显示最后一行是“END”。我做错了什么?我是 java.pls 的初学者,请帮助...
我的工作脚本:
try {
Socket s = new Socket("10.0.2.2", 5555);
BufferedReader in = new BufferedReader(new InputStreamReader(s.getInputStream()));
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(s.getOutputStream(), "ISO8859_1"));
String on_air = "request.on_air" + System.getProperty("line.separator");
out.write(on_air);
out.flush();
Log.i("TcpClient", "sent: " + on_air);
String on_airin = in.readLine() + System.getProperty("line.separator");
Log.i("TcpClient", "received: " + on_airin);
String metadata = "ao.metadata "+ on_airin + System.getProperty("line.separator");
out.write(metadata);
out.flush();
Log.i("TcpClient", "sent2: " + metadata);
String metadatain = in.readLine() + System.getProperty("line.separator");
Log.i("TcpClient", "received: " + metadatain);
String line = in.readLine();
while (line != null) {
line = in.readLine();
System.out.println(line);
output = (TextView) findViewById(R.id.textView2);
output.setText(line);
//tv.setText(online + formatedDate );
output = (TextView) findViewById(R.id.textView1);
s.close();
}} catch (UnknownHostException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
我的 System.out.println http://pastebin.com/SkfiPXar