Nog een poging...
This commit is contained in:
parent
6ebf3d7b66
commit
13ae830727
2 changed files with 8 additions and 3 deletions
|
@ -77,7 +77,7 @@ int main(){
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
while (!ferror(CONN) && !feof(CONN)){
|
while (!socketError){
|
||||||
//only parse input if available or not yet init'ed
|
//only parse input if available or not yet init'ed
|
||||||
//rightnow = getNowMS();
|
//rightnow = getNowMS();
|
||||||
retval = epoll_wait(poller, events, 1, 0);
|
retval = epoll_wait(poller, events, 1, 0);
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
bool socketError = false;
|
||||||
|
|
||||||
int DDV_Listen(int port){
|
int DDV_Listen(int port){
|
||||||
int s = socket(AF_INET, SOCK_STREAM, 0);
|
int s = socket(AF_INET, SOCK_STREAM, 0);
|
||||||
|
@ -36,9 +37,13 @@ int DDV_Accept(int sock){
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DDV_write(char * buffer, int width, int count, int sock){
|
bool DDV_write(char * buffer, int width, int count, int sock){
|
||||||
return (send(sock, buffer, width*count, 0) == width*count);
|
bool r = (send(sock, buffer, width*count, 0) == width*count);
|
||||||
|
if (!r){socketError = true}
|
||||||
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DDV_read(char * buffer, int width, int count, int sock){
|
bool DDV_read(char * buffer, int width, int count, int sock){
|
||||||
return (recv(sock, buffer, width*count, 0) == width*count);
|
bool r = (recv(sock, buffer, width*count, 0) == width*count);
|
||||||
|
if (!r){socketError = true}
|
||||||
|
return r;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue