Beispiel #1
0
  public static void main(String[] args) {
    System.out.println("waiting");

    try {
      ServerSocket serverSocket = new ServerSocket(34561);
      FunctionGroup langRuntime = new FunctionGroup(System.out);

      while (true) {
        Socket socket = serverSocket.accept();
        //                System.out.println("client connected");
        Thread myThread =
            new Thread(
                () -> {
                  try {
                    DataInputStream dataInputStream = new DataInputStream(socket.getInputStream());
                    PrintStream printStream = new PrintStream(socket.getOutputStream());
                    while (true) {
                      String line = dataInputStream.readLine();
                      //                            langRuntime.stripParenAndExecute(line);
                      printStream.println(langRuntime.getEnvironment().getBufferVariable());
                    }
                  } catch (IOException e) {
                  }
                });
        myThread.start();
      }
    } catch (IOException e) {
      e.printStackTrace();
    }
  }