DDVSocket edits

This commit is contained in:
Thulinma 2010-11-08 16:29:06 +01:00
parent 7ef4d086ff
commit 548e6aab95
2 changed files with 5 additions and 1 deletions

View file

@ -88,7 +88,11 @@ bool DDV_write(void * buffer, int todo, int sock){
bool DDV_ready(int sock){
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);
fcntl(sock, F_SETFL, preflags);
return (r == 1);
}