O
oziris
hi !
Here the piece of code that creates my BufferedReader object
--- code ---
Socket socket = new Socket(....);
BufferedReader inSocket =
new BufferedReader(
new InputStreamReader(
m_socketService.getInputStream()));
--- /code ---
My request concerns the method readline() of this object. According to
what I understood of my readings, I expect from this method it blocks
itself until data comes to the socket.
Is that correct? Because in my implementation, this method returns
always null if there is no data to read. So I have to write this
--- code ---
String requete;
if ((requete = inSocket.readLine()) != null)
{
// do something
}
--- /code ---
And that sounds bad to me. It's like an infinite loop...
Thanks a lot for your precious advices.
-o--
Here the piece of code that creates my BufferedReader object
--- code ---
Socket socket = new Socket(....);
BufferedReader inSocket =
new BufferedReader(
new InputStreamReader(
m_socketService.getInputStream()));
--- /code ---
My request concerns the method readline() of this object. According to
what I understood of my readings, I expect from this method it blocks
itself until data comes to the socket.
Is that correct? Because in my implementation, this method returns
always null if there is no data to read. So I have to write this
--- code ---
String requete;
if ((requete = inSocket.readLine()) != null)
{
// do something
}
--- /code ---
And that sounds bad to me. It's like an infinite loop...
Thanks a lot for your precious advices.
-o--