File tree Expand file tree Collapse file tree 2 files changed +11
-8
lines changed Expand file tree Collapse file tree 2 files changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -111,7 +111,9 @@ class TCPSocket : public Socket {
111
111
* @param data Destination buffer for data received from the host
112
112
* @param size Size of the buffer in bytes
113
113
* @return Number of received bytes on success, negative error
114
- * code on failure
114
+ * code on failure. If no data is available to be received
115
+ * and the peer has performed an orderly shutdown,
116
+ * recv() returns 0.
115
117
*/
116
118
nsapi_size_or_error_t recv (void *data, nsapi_size_t size);
117
119
Original file line number Diff line number Diff line change @@ -94,17 +94,18 @@ class UDPSocket : public Socket {
94
94
nsapi_size_or_error_t sendto (const SocketAddress &address,
95
95
const void *data, nsapi_size_t size);
96
96
97
- /* * Receive a packet over a UDP socket
97
+ /* * Receive a datagram over a UDP socket
98
98
*
99
- * Receives data and stores the source address in address if address
100
- * is not NULL. Returns the number of bytes received into the buffer.
99
+ * Receives a datagram and stores the source address in address if address
100
+ * is not NULL. Returns the number of bytes written into the buffer. If the
101
+ * datagram is larger than the buffer, the excess data is silently discarded.
101
102
*
102
- * By default, recvfrom blocks until data is sent . If socket is set to
103
- * non-blocking or times out, NSAPI_ERROR_WOULD_BLOCK is returned
104
- * immediately .
103
+ * By default, recvfrom blocks until a datagram is received . If socket is set to
104
+ * non-blocking or times out with no datagram, NSAPI_ERROR_WOULD_BLOCK
105
+ * is returned .
105
106
*
106
107
* @param address Destination for the source address or NULL
107
- * @param data Destination buffer for data received from the host
108
+ * @param data Destination buffer for datagram received from the host
108
109
* @param size Size of the buffer in bytes
109
110
* @return Number of received bytes on success, negative error
110
111
* code on failure
You can’t perform that action at this time.
0 commit comments