Skip to content

Commit 6b4f3f5

Browse files
authored
Add mention of control versions to sendto/recvfrom. (#1484)
1 parent b1c08f3 commit 6b4f3f5

File tree

4 files changed

+8
-2
lines changed

4 files changed

+8
-2
lines changed

docs/api/connectivity/arch/securesocket-arch.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,11 @@ virtual nsapi_size_or_error_t send(const void *data, nsapi_size_t size);
109109
virtual nsapi_size_or_error_t recv(void *data, nsapi_size_t size);
110110
virtual nsapi_size_or_error_t sendto(const SocketAddress &address, const void *data, nsapi_size_t size);
111111
virtual nsapi_size_or_error_t recvfrom(SocketAddress *address, void *data, nsapi_size_t size);
112+
virtual nsapi_size_or_error_t sendto_control(nsapi_socket_t handle, const SocketAddress &address, const void *data, nsapi_size_t size, nsapi_msghdr_t *control, nsapi_size_t control_size);
113+
virtual nsapi_size_or_error_t recvfrom_control(nsapi_socket_t handle, SocketAddress *address, void *data, nsapi_size_t size, nsapi_msghdr_t *control, nsapi_size_t control_size);
112114
```
113115

114-
These work as expected, but `SocketAddress` parameters are ignored. The TLS connection cannot change the peer. Also, `recvfrom()` call does not set the peer address.
116+
These work as expected, but `SocketAddress` parameters are ignored. The TLS connection cannot change the peer. Also, `recvfrom()` and `recvfrom_control()` call does not set the peer address.
115117

116118
Mbed TLS error codes `MBEDTLS_ERR_SSL_WANT_READ` and `MBEDTLS_ERR_SSL_WANT_WRITE` are translated to `NSAPI_ERROR_WOULD_BLOCK` before passing to user.
117119

docs/api/connectivity/networksocket/UDPSocket.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<span class="images">![](https://os.mbed.com/docs/mbed-os/development/mbed-os-api-doxy/class_u_d_p_socket.png)<span>UDPSocket class hierarchy</span></span>
44

5-
The UDPSocket class provides the ability to send packets of data over UDP, using the `sendto` and `recvfrom` member functions. Packets can be lost or arrive out of order, so we suggest using a [TCPSocket](../apis/tcpsocket.html) when you require guaranteed delivery.
5+
The UDPSocket class provides the ability to send packets of data over UDP, using the `sendto`/`sendto_control` and `recvfrom`/`recvfrom_control` member functions. Packets can be lost or arrive out of order, so we suggest using a [TCPSocket](../apis/tcpsocket.html) when you require guaranteed delivery.
66

77
The constructor takes no parameters. To initialize the socket on a specified NetworkInterface, you must call `open` method, which takes a NetworkStack pointer.
88

docs/api/connectivity/networksocket/socket.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ The Socket class defines the Mbed OS Socket API and loosely follows the POSIX st
1616
| `Socket::recv()` | Receive data from a socket | [recv](http://pubs.opengroup.org/onlinepubs/9699919799/functions/recv.html) |
1717
| `Socket::sendto()` | Sends data to the specified address. | [sendto](http://pubs.opengroup.org/onlinepubs/9699919799/functions/sendto.html) |
1818
| `Socket::recvfrom()` | Receives data and stores the source address | [recvfrom](http://pubs.opengroup.org/onlinepubs/9699919799/functions/recvfrom.html) |
19+
| `Socket::sendto_control()` | Similar to `sendto` but support message control through ancilary data. | [sendto](http://pubs.opengroup.org/onlinepubs/9699919799/functions/sendto.html), [sendmsg](https://pubs.opengroup.org/onlinepubs/9699919799/functions/sendmsg.html) |
20+
| `Socket::recvfrom_control()` | Similar to `recvfrom` but support message control through ancilary data. | [recvfrom](http://pubs.opengroup.org/onlinepubs/9699919799/functions/recvfrom.html), [sendmsg](https://pubs.opengroup.org/onlinepubs/9699919799/functions/recvmsg.html) |
1921
| `Socket::bind()` | Bind a specific address to a socket | [bind](http://pubs.opengroup.org/onlinepubs/9699919799/functions/bind.html) |
2022
| `Socket::listen()` | Listen for incoming connections | [listen](http://pubs.opengroup.org/onlinepubs/9699919799/functions/listen.html) |
2123
| `Socket::accept()` | Accept incoming connection | [accept](http://pubs.opengroup.org/onlinepubs/9699919799/functions/accept.html) |

docs/porting/connectivity/NetworkStack.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ nsapi_error_t socket_accept(nsapi_socket_t server, nsapi_socket_t *handle, Socke
6666
nsapi_size_or_error_t socket_send(nsapi_socket_t handle, const void *data, nsapi_size_t size);
6767
nsapi_size_or_error_t socket_recv(nsapi_socket_t handle, void *data, nsapi_size_t size);
6868
nsapi_size_or_error_t socket_sendto(nsapi_socket_t handle, const SocketAddress &address, const void *data, nsapi_size_t size);
69+
nsapi_size_or_error_t socket_sendto_control(nsapi_socket_t handle, const SocketAddress &address, const void *data, nsapi_size_t size, nsapi_msghdr_t *control, nsapi_size_t control_size);
6970
nsapi_size_or_error_t socket_recvfrom(nsapi_socket_t handle, SocketAddress *address, void *buffer, nsapi_size_t size);
71+
nsapi_size_or_error_t socket_recvfrom_control(nsapi_socket_t handle, SocketAddress *address, void *data, nsapi_size_t size, nsapi_msghdr_t *control, nsapi_size_t control_size);
7072
nsapi_error_t setsockopt(nsapi_socket_t handle, int level, int optname, const void *optval, unsigned optlen);
7173
nsapi_error_t getsockopt(nsapi_socket_t handle, int level, int optname, void *optval, unsigned *optlen);
7274
```

0 commit comments

Comments
 (0)