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: EthernetInterface.cpp
- Revision:
- 36:0ba2e8d5274a
- Parent:
- 35:fe3028eda085
- Child:
- 38:67e763cdde02
diff -r fe3028eda085 -r 0ba2e8d5274a EthernetInterface.cpp
--- a/EthernetInterface.cpp Tue Oct 10 20:56:13 2017 +0200
+++ b/EthernetInterface.cpp Wed Oct 11 11:18:41 2017 +0200
@@ -26,6 +26,7 @@
ip_set = false;
domainName = NULL;
leaseStart = 0;
+ _hostname = NULL;
}
EthernetInterface::EthernetInterface(SPI* spi, PinName cs, PinName reset) :
@@ -34,6 +35,7 @@
ip_set = false;
domainName = NULL;
leaseStart = 0;
+ _hostname = NULL;
}
#endif
@@ -85,8 +87,10 @@
}
// Connect Bring the interface up, start DHCP if needed.
-int EthernetInterface::connect()
+int EthernetInterface::connect(const char *hostname)
{
+ if (hostname)
+ _hostname = hostname;
if (dhcp) {
int r = IPrenew();
if (r < 0) {
@@ -164,7 +168,7 @@
int EthernetInterface::IPrenew(int timeout_ms)
{
DHCPClient dhcp;
- int err = dhcp.setup(timeout_ms);
+ int err = dhcp.setup(_hostname, timeout_ms);
if (err == (-1)) {
return -1;
}
