|
Ncurses windows and sockets in asynch mode (?)
I would like to write something looking like irssi or bitchx using ncurses. I've prepared a few windows and the problem appears when I want to use window input and a loop, let's see (it's not full code , only a schema) :
fcntl(socket, ....); //sets a socket asynchronous mode
while(1) {
wgetstr(window, buffer) //it get's some data from user in one window
send(...); //sends input data to a socket
recv (....); //receives data from a socket
printf(received data); //prints this data to ther window
}
It's a bit stupid, because this application should still receive data from socket and in the same time from user. But it waait until user put some data and then receives something and print. It should look as a two different loops which are running in the same time. Any ideas?
|