JAVA 数据流,急
public static DataInputStream in;
public static DataOutputStream out;
private void createIO() {
try {
in = new DataInputStream(s.getInputStream());
out = new DataOutputStream(s.getOutputStream());
} catch (Exception ex) {
ex.printStackTrace();
}
}
private void 方法1() {
try {
s = new Socket("192.168.119.2", 7501);
} catch (
UnknownHostException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (
IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (s != null) {
createIO();
try {
out.write(headSignIn);
out.write(byte[]);
out.flush();
num = in.read(bt);
....
}---成功
private void 方法2() {
try {
out.write(headSignIn);
out.write(byte[]);
out.flush();
num = in.read(bt);
....
}---失败 提示
java.net.SocketException: Software caused connection abort: socket write error我先调用方法1成功连接,后台收到包,也可收到后台返回包。然后调用方法2,后台没反应,应该是程序数据没发送成功。
请大家帮忙看看。
------解决方案--------------------
是不是socket已经关闭了?
------解决方案--------------------
connection abort!!!连接中断