473,396 Members | 1,895 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Open URL strange problem

Guy,

I'm trying to open a URL and the good news that I can open it then read the data line by line. the data changes every second so i have to read it in an infinite loop. By other words, load the URL then read it line by line, again and again.

the problem the loop stops but no error msgs, memory is not full and there is nothing taking 100% of the CPU !

The while loop code as follow:

while(true){
//the code to load the URL
System.out.println("Start");
while(true){
System.out.println("Check 1");
if((stringLine = myDataInputStream.readLine()) == null) break;
System.out.println("Check 2");
System.out.println(stringLine);
}
System.out.println("End");
}

After 3-4 hours of running the code print Check1 and stops, i does not terminate, just stops without giving any messages!

It do print some of the URL data lines before this happens, it mean it loaded the URL but somehow the statement "(stringLine = myDataInputStream.readLine()) == null" does not return true neither false !

what is going on !? Help guys

And sorry for my grammar.
Nov 12 '07 #1
2 1095
r035198x
13,262 8TB
Guy,

I'm trying to open a URL and the good news that I can open it then read the data line by line. the data changes every second so i have to read it in an infinite loop. By other words, load the URL then read it line by line, again and again.

the problem the loop stops but no error msgs, memory is not full and there is nothing taking 100% of the CPU !

The while loop code as follow:

while(true){
//the code to load the URL
System.out.println("Start");
while(true){
System.out.println("Check 1");
if((stringLine = myDataInputStream.readLine()) == null) break;
System.out.println("Check 2");
System.out.println(stringLine);
}
System.out.println("End");
}

After 3-4 hours of running the code print Check1 and stops, i does not terminate, just stops without giving any messages!

It do print some of the URL data lines before this happens, it mean it loaded the URL but somehow the statement "(stringLine = myDataInputStream.readLine()) == null" does not return true neither false !

what is going on !? Help guys

And sorry for my grammar.
Why do you have two while loops? Are you reloading the URLs all the time? The code probably breaks out of the inner while when there is no data. Perhaps if you show the complete code you are using as it is ...
Nov 13 '07 #2
Thanks for your reply...

If the code breaks out of the inner while when there is no data, the code should print "End"
the code prints "Check 1" and get stuck !?
it should either print "Check 2" or "End" but it don't !

The code is too long as it login to secured website using username and password then using the given session to open another page.

Anyway I will try to simplify the code and get back to you
Nov 13 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Merlin | last post by:
Hi there, I have a serious problem with opening a new window with the help of JavaScript. The problem only occures with Firefox. Once you click on the item which fires up the open function, the...
13
by: MPH | last post by:
Problem: using a named window as target, a new window is opened anyway. Also, both windows have the same name. This happens on SOME machines only env: XP sp2 ie6.0.2900.2180 + sp2 ...
3
by: TM360 | last post by:
I realize this may not be the right group to post this, but I'm not having much success elsewhere so I thought I'd give it a try... In our application we have a link that opens a new window...
0
by: news.paradise.net.nz | last post by:
My database appears to be a little corrupted, so far it's running along 99% ok, but i am getting some strange results. Primarily i can't back it up because of the following error. Similar errors...
1
by: Skip Key | last post by:
While writing a windows service, I've run into a fairly strange problem. I have a worker proc that gets fired every n seconds using System.Threading.Timer. This works fine, unless I open an...
4
by: John | last post by:
Hi, I generate a report in a comma delimited file and give it a name like MyReport.csv . I then set a Hyperlink control to point tp the file HyperLink1.text = "Download"...
1
by: Melissa | last post by:
I have inherited an intranet ASP.NET (C#) page running on Windows 2000. The page populates a label control with some javascript to open a pop-up to a document (xls, doc, pdf, etc.). This is...
3
by: Mugunth | last post by:
Hi, I've a strange problem with serial port class of .NET Framework 2.0 I use com0com (Null Modem COM Port emulator) to emulate a virtual port. This application creates virtual com port pairs...
8
by: shenkel55 | last post by:
I'm using Access and Excel 2003. Using either the import wizard or code, I have the same problem. This problem only happens with Excel files automatically generated by Corp IT. If I try to do an...
3
by: Simon van Beek | last post by:
Dear reader, What can be wrong in my ComboBox, the property "Auto Expand" is set to Yes, but by typing in the ComboBox it doesn't expand. Is this because the source of the ComboBox is a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.