I had to create another thread to read the input to a buffer and read back in the main thread. I do not know a way to read the input stream without block the server main thread (e.g. cin >> a, getline(cin, str) ...)