What should I do if a IOException is thrown?

Posted by Roman on Stack Overflow See other posts from Stack Overflow or by Roman
Published on 2010-03-23T11:59:35Z Indexed on 2010/03/23 12:03 UTC
Read the original article Hit count: 281

Filed under:
|

I have the following 3 lines of the code:

ServerSocket listeningSocket = new ServerSocket(earPort);
Socket serverSideSocket = listeningSocket.accept();
BufferedReader in = new BufferedReader(new InputStreamReader(serverSideSocket.getInputStream()));

The compiler complains about all of these 3 lines and its complain is the same for all 3 lines: unreported exception java.io.IOException; In more details, these exception are thrown by new ServerSocket, accept() and getInputStream().

I know I need to use try ... catch .... But for that I need to know what this exceptions mean in every particular case (how should I interpret them). When they happen? I mean, not in general, but in these 3 particular cases.

© Stack Overflow or respective owner

Related posts about java

Related posts about exception-handling