I read about how to program network sockets and ran through this piece of code:
try { while (true) { // This is the line in question int i = in.read( ); if (i == -1) break; System.out.write(i); } } catch (SocketException e) { // output thread closed the socket } catch (IOException e) { System.err.println(e); }
How does the second line know when the crash? In other words, how does the while(true) work? I guess I donβt understand: "And what is the truth?"
source share