Java URL I/O Problem

Joined
Sep 25, 2006
Messages
1
Reaction score
0
Hello!

I'm writing a client-side application that would read info from server database through Apache and PHP. However, when I send a request to the PHP script:

URL url = new URL(Main.URLPATH+"getTracksByCoord.php?"+"track="+TrackListInfo.tablename+"&chr="+chr+"&from="+from+"&to="+to);

URLConnection conn = url.openConnection();
conn.connect();

BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));


and then start reading the data prited by PHP script in a cycle:

while ((String line = in.readLine()) != null ){
.................................
}


it appears that Java reads faster then the script prints rows, which leads that BufferedReader ends prematurely.
Is there any way to make client-side Java application wait until the server-side script finishes printing data?

Regards,
Nickolai Samusik,
St.Petersburg, Russia
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top