@@ -77,7 +77,13 @@ class TCPSocket : public InternetSocket {
77
77
*
78
78
* @param host Hostname of the remote host
79
79
* @param port Port of the remote host
80
- * @return 0 on success, negative error code on failure
80
+ * @retval NSAPI_ERROR_OK on success
81
+ * @retval NSAPI_ERROR_IN_PROGRESS if the operation is ongoing
82
+ * @retval NSAPI_ERROR_NO_SOCKET if the socket has not been allocated
83
+ * @retval NSAPI_ERROR_DNS_FAILURE if the DNS address of host could not be resolved
84
+ * @retval NSAPI_ERROR_IS_CONNECTED if the connection is already established
85
+ * @retval int Other negative error codes for stack-related failures.
86
+ * See NetworkStack::socket_connect().
81
87
*/
82
88
nsapi_error_t connect (const char *host, uint16_t port);
83
89
@@ -87,7 +93,13 @@ class TCPSocket : public InternetSocket {
87
93
* indicated address.
88
94
*
89
95
* @param address The SocketAddress of the remote host
90
- * @return 0 on success, negative error code on failure
96
+ * @retval NSAPI_ERROR_OK on success
97
+ * @retval NSAPI_ERROR_IN_PROGRESS if the operation is ongoing
98
+ * @retval NSAPI_ERROR_NO_SOCKET if the socket has not been allocated
99
+ * @retval NSAPI_ERROR_DNS_FAILURE if the DNS address of host could not be resolved
100
+ * @retval NSAPI_ERROR_IS_CONNECTED if the connection is already established
101
+ * @retval int Other negative error codes for stack-related failures.
102
+ * See NetworkStack::socket_connect().
91
103
*/
92
104
virtual nsapi_error_t connect (const SocketAddress &address);
93
105
@@ -102,8 +114,12 @@ class TCPSocket : public InternetSocket {
102
114
*
103
115
* @param data Buffer of data to send to the host
104
116
* @param size Size of the buffer in bytes
105
- * @return Number of sent bytes on success, negative error
106
- * code on failure
117
+ * @retval int Number of sent bytes on success
118
+ * @retval NSAPI_ERROR_NO_SOCKET in case socket was not created correctly
119
+ * @retval NSAPI_ERROR_WOULD_BLOCK in case non-blocking mode is enabled
120
+ * and send cannot be performed immediately
121
+ * @retval int Other negative error codes for stack-related failures.
122
+ * See \ref NetworkStack::socket_send.
107
123
*/
108
124
virtual nsapi_size_or_error_t send (const void *data, nsapi_size_t size);
109
125
@@ -118,10 +134,12 @@ class TCPSocket : public InternetSocket {
118
134
*
119
135
* @param data Destination buffer for data received from the host
120
136
* @param size Size of the buffer in bytes
121
- * @return Number of received bytes on success, negative error
122
- * code on failure. If no data is available to be received
123
- * and the peer has performed an orderly shutdown,
124
- * recv() returns 0.
137
+ * @retval int Number of received bytes on success
138
+ * @retval NSAPI_ERROR_NO_SOCKET in case socket was not created correctly
139
+ * @retval NSAPI_ERROR_WOULD_BLOCK in case non-blocking mode is enabled
140
+ * and send cannot be performed immediately
141
+ * @retval int Other negative error codes for stack-related failures.
142
+ * See \ref NetworkStack::socket_recv.
125
143
*/
126
144
virtual nsapi_size_or_error_t recv (void *data, nsapi_size_t size);
127
145
@@ -136,8 +154,12 @@ class TCPSocket : public InternetSocket {
136
154
* @param address Remote address
137
155
* @param data Buffer of data to send to the host
138
156
* @param size Size of the buffer in bytes
139
- * @return Number of sent bytes on success, negative error
140
- * code on failure
157
+ * @retval int Number of sent bytes on success
158
+ * @retval NSAPI_ERROR_NO_SOCKET in case socket was not created correctly
159
+ * @retval NSAPI_ERROR_WOULD_BLOCK in case non-blocking mode is enabled
160
+ * and send cannot be performed immediately
161
+ * @retval int Other negative error codes for stack-related failures.
162
+ * See \ref NetworkStack::socket_send.
141
163
*/
142
164
virtual nsapi_size_or_error_t sendto (const SocketAddress &address,
143
165
const void *data, nsapi_size_t size);
@@ -154,8 +176,12 @@ class TCPSocket : public InternetSocket {
154
176
* @param address Destination for the source address or NULL
155
177
* @param data Destination buffer for datagram received from the host
156
178
* @param size Size of the buffer in bytes
157
- * @return Number of received bytes on success, negative error
158
- * code on failure
179
+ * @retval int Number of received bytes on success
180
+ * @retval NSAPI_ERROR_NO_SOCKET in case socket was not created correctly
181
+ * @retval NSAPI_ERROR_WOULD_BLOCK in case non-blocking mode is enabled
182
+ * and send cannot be performed immediately
183
+ * @retval int Other negative error codes for stack-related failures.
184
+ * See \ref NetworkStack::socket_recv.
159
185
*/
160
186
virtual nsapi_size_or_error_t recvfrom (SocketAddress *address,
161
187
void *data, nsapi_size_t size);
@@ -182,7 +208,10 @@ class TCPSocket : public InternetSocket {
182
208
*
183
209
* @param backlog Number of pending connections that can be queued
184
210
* simultaneously, defaults to 1
185
- * @return 0 on success, negative error code on failure
211
+ * @retval NSAPI_ERROR_OK on success
212
+ * @retval NSAPI_ERROR_NO_SOCKET in case socket was not created correctly
213
+ * @retval int Other negative error codes for stack-related failures.
214
+ * See \ref NetworkStack::socket_listen.
186
215
*/
187
216
virtual nsapi_error_t listen (int backlog = 1 );
188
217
0 commit comments