Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.82 KB | None | 0 0
  1.  try {
  2.             out = new PrintWriter(clientSocket.getOutputStream(), true);
  3.             in = new BufferedReader(
  4.                 new InputStreamReader(
  5.                 clientSocket.getInputStream()));
  6.         } catch (IOException e) {
  7.             System.err.println("Couldn't get I/O.");
  8.             System.exit(1);      
  9.         }      
  10.         while (running) {
  11.             try {
  12.                 outputLine=getOutput(in);
  13.             } catch(SocketTimeoutException ex){
  14.                 outputLine="502 TIMEOUT";
  15.                 stop();
  16.             } catch (IOException ex) {
  17.                 System.err.println("Couldn't get I/O.");
  18.             }
  19.             if(outputLine.equals("break")){
  20.                 stop();
  21.             }else{
  22.                 out.print(outputLine + "\r\n");
  23.                 out.flush();
  24.             }
  25.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement