I'm getting a full file from a server, doing:
cout << (int)buffer << " - " << buffer << endl;
If I don't set the O_NONBLOCK flag this works fine, except that after the last character has been read, the next read() blocks, and I want it to exit the while(). But if I set the nonblocking flag, then it doesn't read a single character.
What am I missing?