DDVSocket edits
This commit is contained in:
parent
83f59d4213
commit
8081e4cb66
1 changed files with 4 additions and 0 deletions
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue