help, i get socket closed exception for this code:
and the error is in this link:package mash.craft.serv.server; import java.net.*; import java.io.*; import com.mysql.jdbc.ConnectionFeatureNotAvailableException; public class ServerThread implements Runnable { private ServerSocket socket1 = null; private Socket socket = null; public ServerThread(ServerSocket serverSocket) { this.socket1 = serverSocket; } public void run() { try { socket = socket1.accept(); //THIS IS LINE 19 PrintWriter out = new PrintWriter(socket.getOutputStream(), true); BufferedReader in = new BufferedReader( new InputStreamReader( socket.getInputStream())); String inputLine, outputLine; Protocol kkp = new Protocol(); outputLine = kkp.processInput("logged in"); out.println(outputLine); while ((inputLine = in.readLine()) != null) { outputLine = kkp.processInput(inputLine); out.println(outputLine); if (outputLine.equals("stop")) break; } out.close(); in.close(); socket.close(); } catch (IOException e) { e.printStackTrace(); } } }
22:39:46 [SEVERE] java.net.SocketException: Socket is closed
22:39:46 [SEVERE] at java.net.ServerSocket.accept(Unknown Source)
22:39:46 [SEVERE] at mash.craft.serv.server.ServerThread.run(ServerThre ad.
java:19)