【发布时间】:2012-03-24 00:13:20
【问题描述】:
知道为什么这个 system.exit(0) 在执行 sendTCPBytes1 到 localhost 后没有被执行吗?
public static void killerButton() throws IOException {
String myCmd;
if (C.getOs().equals("Linux")) {
} else {
System.out.println("[bug]: forceclose");
sendTCPBytes1("forceclose", "localhost");
System.exit(0);
}
}
public static void sendTCPBytes1(String filmfr2, String localhost) throws IOException {
String downloaded = null;
Socket socket = new Socket(localhost, 58888);
DataOutputStream upload = new DataOutputStream(socket.getOutputStream());
BufferedReader download = new BufferedReader(new InputStreamReader(socket.getInputStream()));
String c = filmfr2;
upload.writeBytes(c);
upload.flush();
String get;
downloaded = download.readLine();
System.out.println("[TCP]: FROM server: >>> " + downloaded);
socket.close();
}
【问题讨论】:
-
这段代码没有意义。
C是什么?killerButton是从哪里调用的? -
你怎么知道它没有被调用?
-
你在
sendTCPBytes1中遇到异常了吗? -
你看到
System.out.println("[TCP]: FROM server: >>> " + downloaded);的输出了吗?