Software caused connection abort: socket write error?
package ok;
import java.net.*;
import java.io.*;
public class Application1 {
public static void main(String args[]) {
try {
ServerSocket server = new ServerSocket(1991);
Socket soc = server.accept();
BufferedOutputStream output = new BufferedOutputStream(soc.
getOutputStream());
BufferedInputStream input = new BufferedInputStream(new
FileInputStream(new File(
"C:\\Documents and Settings\\Administrator\\My Documents\\1.bmp ")));
byte[] zijie=new byte[1024];
while(input.read(zijie)> 0)
{
output.write(zijie);
output.flush();
}
input.close();
output.close(); //把这个去掉就没错了
soc.close();
server.close();
} catch (Exception ex) {
System.out.println( "有错误发生了! " + ex.getMessage());
}
}
}
上面是我写的传图片的代码。 在运行的时候会报
Software caused connection abort: socket write error 这个错误?