try {
int size = 0;
String s = null;
byte[] temp = new byte[11];
Socket sc = new Socket("166.161.0.101", 10000);
OutputStream os = sc.getOutputStream();
InputStream is = sc.getInputStream();
DataOutputStream out = new DataOutputStream(os);
DataInputStream in = new DataInputStream(is);
out.write(bb);
out.write(cc);
out.write(dd);
out.flush();
in.read(temp);
s = new String(temp, 0, size);
for (int v = 0; v < temp.length; v++) {
if (temp[0] == 'A') {
System.out.println("接收返回信息成功~");
} else if (temp[0] == 'E') {
System.out.println("接收返回信息失败~");
}
}
} catch (UnknownHostException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}以上是小弟的输入 输出流代码 但是返回得到是 ‘E’
是这样的 。错误代码有很多种。。
请问加入什么代码 可以 得到反馈 错误的 信息代码
请指教~!!
int size = 0;
String s = null;
byte[] temp = new byte[11];
Socket sc = new Socket("166.161.0.101", 10000);
OutputStream os = sc.getOutputStream();
InputStream is = sc.getInputStream();
DataOutputStream out = new DataOutputStream(os);
DataInputStream in = new DataInputStream(is);
out.write(bb);
out.write(cc);
out.write(dd);
out.flush();
in.read(temp);
s = new String(temp, 0, size);
for (int v = 0; v < temp.length; v++) {
if (temp[0] == 'A') {
System.out.println("接收返回信息成功~");
} else if (temp[0] == 'E') {
System.out.println("接收返回信息失败~");
}
}
} catch (UnknownHostException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}以上是小弟的输入 输出流代码 但是返回得到是 ‘E’
是这样的 。错误代码有很多种。。
请问加入什么代码 可以 得到反馈 错误的 信息代码
请指教~!!
else if (temp[0] == 'E') {
System.out.println("接收返回信息失败~");
} 执行。说明没有异常。你可以在 自定义一个异常。
但是返回第一给字母是 E 就是错误的
比如 错误的 返回代码有 是 手册上说明的有一些错误代码 比如0X0A 0X0B 0X0C等
我就是想知道 怎么可以得到 显示这个 0X0A等等代码!~!~
要 在哪里再补充一下 代码 还是可以put出来。谢谢 帮忙大虾们!~~