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.
Fork of WIZnetInterface by
Diff: Socket/Endpoint.cpp
- Revision:
- 34:7d44648ec5f2
- Parent:
- 32:f6d76a55a50b
- Child:
- 35:fe3028eda085
diff -r 879cfe51e66e -r 7d44648ec5f2 Socket/Endpoint.cpp
--- a/Socket/Endpoint.cpp Sat Oct 07 22:10:01 2017 +0200
+++ b/Socket/Endpoint.cpp Mon Oct 09 19:58:19 2017 +0200
@@ -36,12 +36,12 @@
//Resolve DNS address or populate hard-coded IP address
WIZnet_Chip* eth = WIZnet_Chip::getInstance();
if (eth == NULL) {
- error("Endpoint constructor error: no WIZnet chip instance available!\r\n");
+ printf("Endpoint constructor error: no WIZnet chip instance available!\r\n");
return -1;
}
uint32_t addr;
if (!eth->gethostbyname(host, &addr)) {
- error("DNS error : Cannot get url from DNS server\r\n");
+ printf("DNS error : Cannot get url from DNS server\r\n");
return -1;
}
snprintf(_ipAddress, sizeof(_ipAddress), "%d.%d.%d.%d", (int)(addr>>24)&0xff, (int)(addr>>16)&0xff, (int)(addr>>8)&0xff, (int)addr&0xff);
@@ -49,6 +49,12 @@
return 0;
}
+int Endpoint::set_address(const uint32_t addr, const int port)
+{
+ snprintf(_ipAddress, sizeof(_ipAddress), "%d.%d.%d.%d", (int)(addr>>24)&0xff, (int)(addr>>16)&0xff, (int)(addr>>8)&0xff, (int)addr&0xff);
+ _port = port;
+}
+
char* Endpoint::get_address()
{
return _ipAddress;
