I'm testing things out and i made a non blocking socket but the "fgets" ruined my plans. How can i prevent fgets for blocking out my while loop showing below? A code that solves this would be greatly appreciated.
fcntl(clientSocket, F_SETFL, O_NONBLOCK);
while(1){
fgets(buffer,sizeof(buffer),stdin);
send(clientSocket,buffer,sizeof(buffer),0);
recv(clientSocket,buffer,sizeof(buffer),0);
printf("%s",buffer);
}