I\'m working on a concurrent program; it has two threads, one of which listens messages from a server and the other one sends messages to it. I need to obtain commands from
Some alternatives
have your command dump all the messages that have occurred since the last invocation of the command. That way the output is finite.
have your cli command monitor all traffic continuously until ctrl-c (or some other key combination) is pressed then it reverts back to your application's cli prompt.
have your cli command send data to a file and monitor that with a tail type tool