@@ -49,7 +49,8 @@ class Socket {
4949 * Closes any open connection and deallocates any memory associated
5050 * with the socket. Called from destructor if socket is not closed.
5151 *
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.
5354 */
5455 virtual nsapi_error_t close () = 0;
5556
@@ -68,7 +69,8 @@ class Socket {
6869 * a new one before attempting to reconnect.
6970 *
7071 * @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.
7274 */
7375 virtual nsapi_error_t connect (const SocketAddress &address) = 0;
7476
@@ -84,8 +86,8 @@ class Socket {
8486 *
8587 * @param data Buffer of data to send to the host.
8688 * @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.
8991 */
9092 virtual nsapi_size_or_error_t send (const void *data, nsapi_size_t size) = 0;
9193
@@ -105,8 +107,8 @@ class Socket {
105107 *
106108 * @param data Destination buffer for data received from the host.
107109 * @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
110112 * and the peer has performed an orderly shutdown,
111113 * recv() returns 0.
112114 */
@@ -125,7 +127,7 @@ class Socket {
125127 * @param address Remote address
126128 * @param data Buffer of data to send to the host
127129 * @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
129131 * code on failure
130132 */
131133 virtual nsapi_size_or_error_t sendto (const SocketAddress &address,
@@ -148,8 +150,8 @@ class Socket {
148150 * @param address Destination for the source address or NULL
149151 * @param data Destination buffer for datagram received from the host
150152 * @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
153155 */
154156 virtual nsapi_size_or_error_t recvfrom (SocketAddress *address,
155157 void *data, nsapi_size_t size) = 0;
@@ -160,7 +162,8 @@ class Socket {
160162 * data. If the IP address is zeroed, only the port is bound.
161163 *
162164 * @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.
164167 */
165168 virtual nsapi_error_t bind (const SocketAddress &address) = 0;
166169
@@ -222,7 +225,9 @@ class Socket {
222225 * @param optname Level-specific option name.
223226 * @param optval Option value.
224227 * @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.
226231 */
227232 virtual nsapi_error_t setsockopt (int level, int optname, const void *optval, unsigned optlen) = 0;
228233
@@ -239,7 +244,9 @@ class Socket {
239244 * @param optname Level-specific option name.
240245 * @param optval Destination for option value.
241246 * @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.
243250 */
244251 virtual nsapi_error_t getsockopt (int level, int optname, void *optval, unsigned *optlen) = 0;
245252
@@ -276,7 +283,9 @@ class Socket {
276283 * associated.
277284 *
278285 * @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.
280289 */
281290 virtual nsapi_error_t getpeername (SocketAddress *address) = 0;
282291};
0 commit comments