|
|
|
@ -81,7 +81,7 @@ This function also needs more testing for TCP. */
|
|
|
|
|
char* Sock::recvAll() {
|
|
|
|
|
int num_bytes_received = 0;
|
|
|
|
|
int total_bytes_received = 0;
|
|
|
|
|
char* buffer = (char *)malloc(100);
|
|
|
|
|
char* buffer = (char *)malloc(150);
|
|
|
|
|
bool has_been_read = false;
|
|
|
|
|
|
|
|
|
|
if (this->protocol == ES_UDP) {
|
|
|
|
@ -117,7 +117,8 @@ char* Sock::recvAll() {
|
|
|
|
|
return buffer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Non-blocking recv call - Uses 'select' to poll for data from the FD. */
|
|
|
|
|
/* Non-blocking recv call - Uses 'select' to poll for data from the FD. Returns an empty string if there
|
|
|
|
|
is nothing to read. */
|
|
|
|
|
char* Sock::recvAllNB() {
|
|
|
|
|
struct timeval tv;
|
|
|
|
|
fd_set readfs;
|
|
|
|
@ -131,7 +132,7 @@ char* Sock::recvAllNB() {
|
|
|
|
|
if (FD_ISSET(this->sock_fd, &readfs)) {
|
|
|
|
|
return Sock::recvAll();
|
|
|
|
|
} else {
|
|
|
|
|
return NULL;
|
|
|
|
|
return (char *)"";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|