Hi!
I'm writing small socket problem and I met a problem with unblocking sockets.
I use this function to unblock socket.
Code:
void set_nonblock(int& socket)
{
int flags;
flags = fcntl(socket,F_GETFL,0);
assert(flags != -1);
flags |= O_NONBLOCK;
fcntl(socket,F_SETFL, flags);
};
If I try to set socket unblocked after creating socket, connection to server fails with error "ERROR connecting: Operation now in progress". And if I try to set socket unblocked before reading, program fails with error "ERROR on reading: Resource temporarily unavailable".