Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: UDPSocket.cpp
- Revision:
- 24:656011e49d9f
- Parent:
- 20:dd5f19874adf
- Child:
- 26:0f614f1d0398
--- a/UDPSocket.cpp Tue Apr 19 18:24:24 2016 -0500
+++ b/UDPSocket.cpp Tue Apr 19 18:24:34 2016 -0500
@@ -33,11 +33,33 @@
int UDPSocket::bind(uint16_t port)
{
+ SocketAddress addr(0, port);
+ return bind(addr);
+}
+
+int UDPSocket::bind(const char *address, uint16_t port)
+{
+ SocketAddress addr(address, port);
+ return bind(addr);
+}
+
+int UDPSocket::bind(const SocketAddress &address)
+{
if (!_socket) {
return NSAPI_ERROR_NO_SOCKET;
}
- return _iface->socket_bind(_socket, port);
+ return _iface->socket_bind(_socket, address);
+}
+
+int UDPSocket::sendto(const char *host, uint16_t port, const void *data, unsigned size)
+{
+ SocketAddress addr(_iface, host, port);
+ if (!addr) {
+ return NSAPI_ERROR_DNS_FAILURE;
+ }
+
+ return sendto(addr, data, size);
}
int UDPSocket::sendto(const SocketAddress &address, const void *data, unsigned size)