From 71a5bf4ea69d0094ad47d548a445615b3580d9b2 Mon Sep 17 00:00:00 2001 From: Thulinma Date: Mon, 8 Nov 2010 15:52:53 +0100 Subject: [PATCH] DDVSocket edits --- util/ddv_socket.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/util/ddv_socket.cpp b/util/ddv_socket.cpp index 19bcab59..23f2de8b 100644 --- a/util/ddv_socket.cpp +++ b/util/ddv_socket.cpp @@ -105,8 +105,14 @@ bool DDV_write(void * buffer, int width, int count, int sock){return DDV_write(b int DDV_iwrite(void * buffer, int todo, int sock){ int r = send(sock, buffer, todo, 0); if (r < 0){ - socketError = true; - printf("Could not iwrite! %s\n", strerror(errno)); + switch (errno){ + case EWOULDBLOCK: printf("Write: Would block\n"); break; + default: + socketError = true; + printf("Could not write! %s\n", strerror(errno)); + return false; + break; + } } return r; } @@ -114,8 +120,14 @@ int DDV_iwrite(void * buffer, int todo, int sock){ int DDV_iread(void * buffer, int todo, int sock){ int r = recv(sock, buffer, todo, 0); if (r < 0){ - socketError = true; - printf("Could not iread! %s\n", strerror(errno)); + switch (errno){ + case EWOULDBLOCK: printf("Read: Would block\n"); break; + default: + socketError = true; + printf("Could not read! %s\n", strerror(errno)); + return false; + break; + } } return r; }