@@ -49,7 +49,8 @@ class Socket {
49
49
* Closes any open connection and deallocates any memory associated
50
50
* with the socket. Called from destructor if socket is not closed.
51
51
*
52
- * @return NSAPI_ERROR_OK on success, negative error code on failure
52
+ * @return NSAPI_ERROR_OK on success.
53
+ * Negative subclass-dependent error code on failure.
53
54
*/
54
55
virtual nsapi_error_t close () = 0;
55
56
@@ -68,7 +69,8 @@ class Socket {
68
69
* a new one before attempting to reconnect.
69
70
*
70
71
* @param address The SocketAddress of the remote peer.
71
- * @return NSAPI_ERROR_OK on success, negative error code on failure.
72
+ * @return NSAPI_ERROR_OK on success.
73
+ * Negative subclass-dependent error code on failure.
72
74
*/
73
75
virtual nsapi_error_t connect (const SocketAddress &address) = 0;
74
76
@@ -84,8 +86,8 @@ class Socket {
84
86
*
85
87
* @param data Buffer of data to send to the host.
86
88
* @param size Size of the buffer in bytes.
87
- * @return Number of sent bytes on success, negative error
88
- * code on failure.
89
+ * @return NSAPI_ERROR_OK on success.
90
+ * Negative subclass-dependent error code on failure.
89
91
*/
90
92
virtual nsapi_size_or_error_t send (const void *data, nsapi_size_t size) = 0;
91
93
@@ -105,8 +107,8 @@ class Socket {
105
107
*
106
108
* @param data Destination buffer for data received from the host.
107
109
* @param size Size of the buffer in bytes.
108
- * @return Number of received bytes on success, negative error
109
- * code on failure. If no data is available to be received
110
+ * @return Number of received bytes on success, negative, subclass-dependent
111
+ * error code on failure. If no data is available to be received
110
112
* and the peer has performed an orderly shutdown,
111
113
* recv() returns 0.
112
114
*/
@@ -125,7 +127,7 @@ class Socket {
125
127
* @param address Remote address
126
128
* @param data Buffer of data to send to the host
127
129
* @param size Size of the buffer in bytes
128
- * @return Number of sent bytes on success, negative error
130
+ * @return Number of sent bytes on success, negative subclass-dependent error
129
131
* code on failure
130
132
*/
131
133
virtual nsapi_size_or_error_t sendto (const SocketAddress &address,
@@ -148,8 +150,8 @@ class Socket {
148
150
* @param address Destination for the source address or NULL
149
151
* @param data Destination buffer for datagram received from the host
150
152
* @param size Size of the buffer in bytes
151
- * @return Number of received bytes on success, negative error
152
- * code on failure
153
+ * @return Number of received bytes on success, negative subclass-dependent
154
+ * error code on failure
153
155
*/
154
156
virtual nsapi_size_or_error_t recvfrom (SocketAddress *address,
155
157
void *data, nsapi_size_t size) = 0;
@@ -160,7 +162,8 @@ class Socket {
160
162
* data. If the IP address is zeroed, only the port is bound.
161
163
*
162
164
* @param address Local address to bind.
163
- * @return NSAPI_ERROR_OK on success, negative error code on failure.
165
+ * @return NSAPI_ERROR_OK on success, negative subclass-dependent error
166
+ * code on failure.
164
167
*/
165
168
virtual nsapi_error_t bind (const SocketAddress &address) = 0;
166
169
@@ -222,7 +225,9 @@ class Socket {
222
225
* @param optname Level-specific option name.
223
226
* @param optval Option value.
224
227
* @param optlen Length of the option value.
225
- * @return NSAPI_ERROR_OK on success, negative error code on failure.
228
+ * @retval NSAPI_ERROR_OK on success.
229
+ * @retval NSAPI_ERROR_NO_SOCKET if socket is not open.
230
+ * @retval int Negative error code on failure, see @ref NetworkStack::setsockopt.
226
231
*/
227
232
virtual nsapi_error_t setsockopt (int level, int optname, const void *optval, unsigned optlen) = 0;
228
233
@@ -239,7 +244,9 @@ class Socket {
239
244
* @param optname Level-specific option name.
240
245
* @param optval Destination for option value.
241
246
* @param optlen Length of the option value.
242
- * @return NSAPI_ERROR_OK on success, negative error code on failure.
247
+ * @retval NSAPI_ERROR_OK on success.
248
+ * @retval NSAPI_ERROR_NO_SOCKET if socket is not open.
249
+ * @retval int Negative error code on failure, see @ref NetworkStack::getsockopt.
243
250
*/
244
251
virtual nsapi_error_t getsockopt (int level, int optname, void *optval, unsigned *optlen) = 0;
245
252
@@ -276,7 +283,9 @@ class Socket {
276
283
* associated.
277
284
*
278
285
* @param address Pointer to SocketAddress structure.
279
- * @return NSAPI_ERROR_OK on success, negative error code on failure.
286
+ * @retval NSAPI_ERROR_OK on success.
287
+ * @retval NSAPI_ERROR_NO_SOCKET if socket is not connected.
288
+ * @retval NSAPI_ERROR_NO_CONNECTION if the remote peer was not set.
280
289
*/
281
290
virtual nsapi_error_t getpeername (SocketAddress *address) = 0;
282
291
};
0 commit comments