java - Exception on Mac only: Unexpected end of file from server -


i downloading mp3 , image files using "org.apache.commons.io.fileutils" in following code on windows 7:

fileutils.copyurltofile(new url(urlstring),myfile); 

but on mac os x yosemite version 10.10.2 (14c1514) exception after few downloads:

   java.net.socketexception: unexpected end of file server     @ sun.net.www.http.httpclient.parsehttpheader(httpclient.java:792)     @ sun.net.www.http.httpclient.parsehttp(httpclient.java:647)     @ sun.net.www.http.httpclient.parsehttpheader(httpclient.java:789)     @ sun.net.www.http.httpclient.parsehttp(httpclient.java:647)     @ sun.net.www.protocol.http.httpurlconnection.getinputstream0(httpurlconnection.java:1535)     @ sun.net.www.protocol.http.httpurlconnection.getinputstream(httpurlconnection.java:1440) 

i have tried adding timeout

fileutils.copyurltofile(new url(url),myfile ,60000,60000); 

or using other methods

urlconnection conn = new url(url).openconnection(); inputstream = conn.getinputstream(); outputstream outstream = new fileoutputstream(myfile); byte[] buffer = new byte[4096]; int len; while ((len = is.read(buffer)) > 0) {     outstream.write(buffer, 0, len); } outstream.close(); 

update:

i tried disable wifi (to avoid connectivity bugs mentioned @john) , used wired ethernet still have same error after few downloads, appreciated.

that isp related, issue resolved.


Comments

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -