java - connection reset exception for large files -
java - connection reset exception for large files -
i have custom http server seek read server's space browser.
for big files (>10mb) "connection reset exception '. smaller files able write browser.
my server reads zipped content, wrap zipinflaterinputstream within bufferedinputstream, , server reads bufferedinputstream. when extract zip , read fileinputstream it's working fine.
for below code have. "data" variable of type bufferedinputstream , "outputstream" of instance of socketoutputstream.
try { if (requestmethod != method.head && info != null) { int buffer_size = 16 * 1024; byte[] buff = new byte[buffer_size]; while (pending > 0) { int read = data.read(buff, 0, ((pending > buffer_size) ? buffer_size : pending)); if (read <= 0) { break; } outputstream.write(buff, 0, read); pending -= read; } } } grab (ioexception e) { logger.error("bytes read while exception thrown" + pending); throw e; }
cheers, saurav
java sockets http
Comments
Post a Comment