DDVSocket edits

This commit is contained in:
Thulinma 2010-11-08 16:29:06 +01:00
parent 83f59d4213
commit 8081e4cb66

View file

@ -88,7 +88,11 @@ bool DDV_write(void * buffer, int todo, int sock){
bool DDV_ready(int sock){ bool DDV_ready(int sock){
char tmp; char tmp;
int preflags = fcntl(sock, F_GETFL, 0);
int postflags = preflags | O_NONBLOCK;
fcntl(sock, F_SETFL, postflags);
int r = recv(sock, &tmp, 1, MSG_PEEK); int r = recv(sock, &tmp, 1, MSG_PEEK);
fcntl(sock, F_SETFL, preflags);
return (r == 1); return (r == 1);
} }