I use NetBeans both at work and at home, v7.0.1. Recently, I developed a small program using HttpURLConnection to read web page and process the contents. It works fine in my office, but not at home! In the office, the whole html code is listed. At home, it stopped in the middle with socket reset or freeze forever. After many testing, I summarize my finding here:
With higher chance (but not always) of success:
1. use read(byteArray, offset, length)
2. use byteArray size = inputStream length
3. write the byteArray to file immediately
4. small inputStream size (e.g web page small)
5. run it in simple java command line (at least stopped at later part of the stream)
With lower chance (almost always) of success:
1. use read()
2. use smaller byteArray size
3. go through any (not just the byteArray in read) array, even a simple loop
4. large inputStream size
5. run it inside a servlet container (stopped at earlier part of the stream)
Again it only failed at home but same codes always works in my office. Anybody has any idea what's wrong.