SOCKET: Use recv/send for all socket io on all platforms
authorRonnie Sahlberg <ronniesahlberg@gmail.com>
Sun, 14 Apr 2013 15:43:59 +0000 (08:43 -0700)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Sun, 14 Apr 2013 15:43:59 +0000 (08:43 -0700)
instead of only on windows and aros  and read/write on the others

lib/socket.c

index 9b16b1b5bc96d045c136945d1dbdd6f69f3a433b..6f626529be9a2c3d6c7b982a648e9edf806d2e2d 100644 (file)
@@ -118,11 +118,7 @@ static int rpc_write_to_socket(struct rpc_context *rpc)
 
                total = rpc->outqueue->outdata.size;
 
-#if defined(WIN32) | defined(AROS)
                count = send(rpc->fd, rpc->outqueue->outdata.data + rpc->outqueue->written, total - rpc->outqueue->written, 0);
-#else
-               count = write(rpc->fd, rpc->outqueue->outdata.data + rpc->outqueue->written, total - rpc->outqueue->written);
-#endif
                if (count == -1) {
                        if (errno == EAGAIN || errno == EWOULDBLOCK) {
                                return 0;
@@ -202,11 +198,7 @@ static int rpc_read_from_socket(struct rpc_context *rpc)
        if (rpc->inpos < 4) {
                size = 4 - rpc->inpos;
 
-#if defined(WIN32) | defined(AROS)
                count = recv(rpc->fd, rpc->inbuf + rpc->inpos, size, 0);
-#else
-               count = read(rpc->fd, rpc->inbuf + rpc->inpos, size);
-#endif
                if (count == -1) {
                        if (errno == EINTR) {
                                return 0;
@@ -242,11 +234,7 @@ static int rpc_read_from_socket(struct rpc_context *rpc)
                size = rpc->insize - rpc->inpos;
        }
 
-#if defined(WIN32) | defined(AROS)
        count = recv(rpc->fd, rpc->inbuf + rpc->inpos, size, 0);
-#else
-       count = read(rpc->fd, rpc->inbuf + rpc->inpos, size);
-#endif
        if (count == -1) {
                if (errno == EINTR) {
                        return 0;