Skip to content

Commit ea296af

Browse files
Mel WeedSeppo Takalo
authored andcommitted
editorial changes, punctuation
1 parent fcd4973 commit ea296af

File tree

1 file changed

+40
-40
lines changed

1 file changed

+40
-40
lines changed

features/netsocket/Socket.h

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,23 @@
2828
/** Socket interface.
2929
*
3030
* This class defines the Mbed OS Socket API.
31-
* Socket is an abstract interface for communicating to remote endpoints.
31+
* Socket is an abstract interface for communicating with remote endpoints.
3232
*
33-
* This API is intented to use for applications and libraries instead of
34-
* using some protocol specific implementation of it. For example TCPSocket
35-
* and UDPSocket are implementations of Socket interface.
36-
* Socket API is intentionally not protocol specific and allows all protocol
37-
* to provide same API regardless of underlying transport mechanism.
33+
* This API is intented for applications and libraries instead of
34+
* protocol-specific implementations. For example, TCPSocket
35+
* and UDPSocket are implementations of the Socket interface.
36+
* Socket API is intentionally not protocol-specific, and allows all protocol
37+
* to provide the same API regardless of the underlying transport mechanism.
3838
*/
3939
class Socket {
4040
public:
4141
/** Destroy a socket.
4242
*
43-
* Closes socket if the socket is still open
43+
* Closes socket if the socket is still open.
4444
*/
4545
virtual ~Socket() {}
4646

47-
/** Close the socket.
47+
/** Closes the socket.
4848
*
4949
* Closes any open connection and deallocates any memory associated
5050
* with the socket. Called from destructor if socket is not closed.
@@ -55,53 +55,53 @@ class Socket {
5555

5656
/** Connects socket to a remote address.
5757
*
58-
* Attempt to make connection on connection-mode protocol or set or reset
58+
* Attempts to make connection on connection-mode protocol or set or reset
5959
* the peer address on connectionless protocol.
6060
*
61-
* Also connectionless protocols use the connected address to filter
61+
* Connectionless protocols also use the connected address to filter
6262
* incoming packets for recv() and recvfrom() calls.
6363
*
64-
* To reset the peer address, zero initialized(default constructor) SocketAddress
65-
* object have to be in the address parameter.
64+
* To reset the peer address, there must be zero initialized(default constructor) SocketAddress
65+
* objects in the address parameter.
6666
*
67-
* @param address The SocketAddress of the remote peer
68-
* @return NSAPI_ERROR_OK on success, negative error code on failure
67+
* @param address The SocketAddress of the remote peer.
68+
* @return NSAPI_ERROR_OK on success, negative error code on failure.
6969
*/
7070
virtual nsapi_error_t connect(const SocketAddress &address) = 0;
7171

7272
/** Send data on a socket
7373
*
7474
* The socket must be connected to a remote host before send() call.
7575
* Returns the number of bytes sent from the buffer.
76-
* In case of connectionless socket, send data to pre-specified remote.
76+
* In case of connectionless socket, sends data to pre-specified remote.
7777
*
7878
* By default, send blocks until all data is sent. If socket is set to
7979
* non-blocking or times out, a partial amount can be written.
8080
* NSAPI_ERROR_WOULD_BLOCK is returned if no data was written.
8181
*
82-
* @param data Buffer of data to send to the host
83-
* @param size Size of the buffer in bytes
82+
* @param data Buffer of data to send to the host.
83+
* @param size Size of the buffer in bytes.
8484
* @return Number of sent bytes on success, negative error
8585
* code on failure.
8686
*/
8787
virtual nsapi_size_or_error_t send(const void *data, nsapi_size_t size) = 0;
8888

8989
/** Receive data from a socket.
9090
*
91-
* Receive data from connected socket or in case of connectionless socket
92-
* this is equivalent of calling recvfrom(NULL, data, size).
91+
* Receive data from connected socket, or in the case of connectionless socket,
92+
* equivalent to calling recvfrom(NULL, data, size).
9393
*
9494
* If socket is connected, only packets coming from connected peer address
9595
* are accepted.
9696
*
97-
* @note recv() is allowed write to data buffer even if error occurs.
97+
* @note recv() is allowed write to data buffer even if an error occurs.
9898
*
9999
* By default, recv blocks until some data is received. If socket is set to
100100
* non-blocking or times out, NSAPI_ERROR_WOULD_BLOCK can be returned to
101101
* indicate no data.
102102
*
103-
* @param data Destination buffer for data received from the host
104-
* @param size Size of the buffer in bytes
103+
* @param data Destination buffer for data received from the host.
104+
* @param size Size of the buffer in bytes.
105105
* @return Number of received bytes on success, negative error
106106
* code on failure. If no data is available to be received
107107
* and the peer has performed an orderly shutdown,
@@ -111,9 +111,9 @@ class Socket {
111111

112112
/** Send a message on a socket.
113113
*
114-
* The sendto() function shall send a message through a connection-mode or connectionless-mode socket.
115-
* If the socket is connectionless-mode, the message shall be sent to the address specified.
116-
* If the socket is connection-mode, address shall be ignored.
114+
* The sendto() function sends a message through a connection-mode or connectionless-mode socket.
115+
* If the socket is in connectionless-mode, the message is sent to the address specified.
116+
* If the socket is in connection-mode, address is ignored.
117117
*
118118
* By default, sendto blocks until data is sent. If socket is set to
119119
* non-blocking or times out, NSAPI_ERROR_WOULD_BLOCK is returned
@@ -156,7 +156,7 @@ class Socket {
156156
* Binding a socket specifies the address and port on which to receive
157157
* data. If the IP address is zeroed, only the port is bound.
158158
*
159-
* @param address Local address to bind
159+
* @param address Local address to bind.
160160
* @return NSAPI_ERROR_OK on success, negative error code on failure.
161161
*/
162162
virtual nsapi_error_t bind(const SocketAddress &address) = 0;
@@ -165,7 +165,7 @@ class Socket {
165165
*
166166
* Initially all sockets are in blocking mode. In non-blocking mode
167167
* blocking operations such as send/recv/accept return
168-
* NSAPI_ERROR_WOULD_BLOCK if they can not continue.
168+
* NSAPI_ERROR_WOULD_BLOCK if they cannot continue.
169169
*
170170
* set_blocking(false) is equivalent to set_timeout(0)
171171
* set_blocking(true) is equivalent to set_timeout(-1)
@@ -179,7 +179,7 @@ class Socket {
179179
* Initially all sockets have unbounded timeouts. NSAPI_ERROR_WOULD_BLOCK
180180
* is returned if a blocking operation takes longer than the specified
181181
* timeout. A timeout of 0 removes the timeout from the socket. A negative
182-
* value give the socket an unbounded timeout.
182+
* value gives the socket an unbounded timeout.
183183
*
184184
* set_timeout(0) is equivalent to set_blocking(false)
185185
* set_timeout(-1) is equivalent to set_blocking(true)
@@ -190,17 +190,17 @@ class Socket {
190190

191191
/** Register a callback on state change of the socket.
192192
*
193-
* The specified callback will be called on state changes such as when
194-
* the socket can recv/send/accept successfully and on when an error
193+
* The specified callback is called on state changes, such as when
194+
* the socket can receive/send/accept successfully and when an error
195195
* occurs. The callback may also be called spuriously without reason.
196196
*
197197
* The callback may be called in an interrupt context and should not
198-
* perform expensive operations such as recv/send calls.
198+
* perform expensive operations such as receive/send calls.
199199
*
200200
* Note! This is not intended as a replacement for a poll or attach-like
201-
* asynchronous api, but rather as a building block for constructing
202-
* such functionality. The exact timing of when the registered function
203-
* is called is not guaranteed and susceptible to change.
201+
* asynchronous API, but rather as a building block for constructing
202+
* such functionality. The exact timing of the registered function
203+
* is not guaranteed and susceptible to change.
204204
*
205205
* @param func Function to call on state change.
206206
*/
@@ -243,15 +243,15 @@ class Socket {
243243
/** Accepts a connection on a socket.
244244
*
245245
* The server socket must be bound and set to listen for connections.
246-
* On a new connection, returns connected network socket which user is expected to call close()
247-
* and that deallocates the resources. Referencing a returned pointer after a close()
246+
* On a new connection, returns connected network socket to call close()
247+
* that deallocates the resources. Referencing a returned pointer after a close()
248248
* call is not allowed and leads to undefined behavior.
249249
*
250250
* By default, accept blocks until incoming connection occurs. If socket is set to
251251
* non-blocking or times out, error is set to NSAPI_ERROR_WOULD_BLOCK.
252252
*
253-
* @param error pointer to storage of the error value or NULL
254-
* @return pointer to a socket
253+
* @param error Pointer to storage of the error value or NULL.
254+
* @return Pointer to a socket.
255255
*/
256256
virtual Socket *accept(nsapi_error_t *error = NULL) = 0;
257257

@@ -261,8 +261,8 @@ class Socket {
261261
* incoming connections.
262262
*
263263
* @param backlog Number of pending connections that can be queued
264-
* simultaneously, defaults to 1
265-
* @return NSAPI_ERROR_OK on success, negative error code on failure
264+
* simultaneously, defaults to 1.
265+
* @return NSAPI_ERROR_OK on success, negative error code on failure.
266266
*/
267267
virtual nsapi_error_t listen(int backlog = 1) = 0;
268268

0 commit comments

Comments
 (0)