public void run() {

        try {
            is = new DataInputStream(client_socket.getInputStream());
            os = new PrintStream(client_socket.getOutputStream());
            String line = null, answer = null;
            System.out.println("Connected with: " + client_socket.getLocalAddress());
            os.println("Connected.");
            while (true) {
                line = is.readLine();
                System.out.println("Received packet from " +client_socket.getInetAddress() + ": " + line);

                if (line.equals("Finished."))
                    break;
                if (line != null) {
                    if (line.indexOf(' ') != -1) {
                        line = line.replaceAll(" ", "");
                    }
                    try {
                       // badugi-connected answers
                    } catch (Exception e) {
                        answer = e.getMessage();
                    }
                }
            }
        } catch (IOException e) {
            System.out.println("Connected with "
                    + client_socket.getInetAddress() + " Lost connection");
            try {
                os.close();
                is.close();
                client_socket.close();
            } catch (IOException ee) {
            }
        }

        try {
            System.out.println("Connection with "
                    + client_socket.getInetAddress() + " finished");
            os.close();
            is.close();
            client_socket.close();
        } catch (IOException e) {
        }

    }