From 7c90d9d8b55962bd4f5fc9d0fd40432f269f7877 Mon Sep 17 00:00:00 2001 From: "David A. Mellis" Date: Thu, 8 Dec 2011 17:29:28 -0500 Subject: [PATCH] Changing recv() to return signed int16 (in Ethernet socket.cpp). S. Wallace http://code.google.com/p/arduino/issues/detail?id=516 --- libraries/Ethernet/utility/socket.cpp | 4 ++-- libraries/Ethernet/utility/socket.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries/Ethernet/utility/socket.cpp b/libraries/Ethernet/utility/socket.cpp index 03ff8504c..fd3e4426a 100644 --- a/libraries/Ethernet/utility/socket.cpp +++ b/libraries/Ethernet/utility/socket.cpp @@ -143,10 +143,10 @@ uint16_t send(SOCKET s, const uint8_t * buf, uint16_t len) * * @return received data size for success else -1. */ -uint16_t recv(SOCKET s, uint8_t *buf, uint16_t len) +int16_t recv(SOCKET s, uint8_t *buf, int16_t len) { // Check how much data is available - uint16_t ret = W5100.getRXReceivedSize(s); + int16_t ret = W5100.getRXReceivedSize(s); if ( ret == 0 ) { // No data available. diff --git a/libraries/Ethernet/utility/socket.h b/libraries/Ethernet/utility/socket.h index 37ea93f3d..45e0fb3e8 100755 --- a/libraries/Ethernet/utility/socket.h +++ b/libraries/Ethernet/utility/socket.h @@ -9,7 +9,7 @@ extern uint8_t connect(SOCKET s, uint8_t * addr, uint16_t port); // Establish TC extern void disconnect(SOCKET s); // disconnect the connection extern uint8_t listen(SOCKET s); // Establish TCP connection (Passive connection) extern uint16_t send(SOCKET s, const uint8_t * buf, uint16_t len); // Send data (TCP) -extern uint16_t recv(SOCKET s, uint8_t * buf, uint16_t len); // Receive data (TCP) +extern int16_t recv(SOCKET s, uint8_t * buf, int16_t len); // Receive data (TCP) extern uint16_t peek(SOCKET s, uint8_t *buf); extern uint16_t sendto(SOCKET s, const uint8_t * buf, uint16_t len, uint8_t * addr, uint16_t port); // Send data (UDP/IP RAW) extern uint16_t recvfrom(SOCKET s, uint8_t * buf, uint16_t len, uint8_t * addr, uint16_t *port); // Receive data (UDP/IP RAW)