I got an assessment to write a simple chat client for Linux using ncurses. The chat has two windows: one displays what the other client says, the other handles user input.
What confuses me here is how to handle data that constantly comes from the socket and waits for the user's input at the same time. The only one solution that comes into my mind is to use pthreads, but I have a feeling that I'm missing something more appropriate.
Any suggestions?