Ho letto questo per quanto riguarda l'impostazione di un socket in modalità non bloccante.Come reimpostare un socket in modalità blocco (dopo averlo impostato in modalità non bloccante)?
http://www.gnu.org/software/libc/manual/html_mono/libc.html#File-Status-Flags
Ecco quello che ho fatto:
static void setnonblocking(int sock)
{
int opts;
opts = fcntl(sock,F_GETFL);
if (opts < 0) {
perror("fcntl(F_GETFL)");
exit(EXIT_FAILURE);
}
opts = (opts | O_NONBLOCK);
if (fcntl(sock,F_SETFL,opts) < 0) {
perror("fcntl(F_SETFL)");
exit(EXIT_FAILURE);
}
return;
}
Come posso impostare il socket torna alla modalità di blocco? Non vedo una bandiera O_BLOCK?
Grazie.
Vedi se [questa risposta] (http://stackoverflow.com/a/18307077/514235) aiuta. – iammilind