Error. Socket do not detect end of read from inputstream. Reference: (b = fi.read()) != -1
and do not detect socket timeout error.
Tested with Mysaifu v 0.4.8 and SO Windows Mobile 6.1
OutputStream os = null;
FileInputStream fi = null;
BufferedOutputStream bos = null;
try {
System.out.println("Writing to: " + s.getRemoteSocketAddress()
+ " at " + new Date());
os = s.getOutputStream();
bos = new BufferedOutputStream(os);
fi = new FileInputStream(fileBDZip);
int b = -1, i = 0;
while ((b = fi.read()) != -1) {
bos.write(b);
i++;
if (i % 10240 == 0) {
System.out.println((i / 1024) + " at " + new Date());
}
}
System.out.println("End Write at " + new Date());
fi.close();
Error. Socket do not detect end of read from inputstream. Reference: (b = fi.read()) != -1 and do not detect socket timeout error. Tested with Mysaifu v 0.4.8 and SO Windows Mobile 6.1
OutputStream os = null; FileInputStream fi = null; BufferedOutputStream bos = null; try { System.out.println("Writing to: " + s.getRemoteSocketAddress() + " at " + new Date()); os = s.getOutputStream(); bos = new BufferedOutputStream(os); fi = new FileInputStream(fileBDZip); int b = -1, i = 0; while ((b = fi.read()) != -1) { bos.write(b); i++; if (i % 10240 == 0) { System.out.println((i / 1024) + " at " + new Date()); } } System.out.println("End Write at " + new Date()); fi.close();
bos.flush(); bos.close(); os.close(); s.close(); } catch (Exception e) { try { if (fi != null) { fi.close(); } if (bos != null) { bos.close(); } if (os != null) { os.close(); } s.close(); e.printStackTrace(); } catch (Exception ex) { ex.printStackTrace(); } }