@@ -33,27 +33,37 @@ int EthernetClass::begin(uint8_t *mac_address)
33
33
}
34
34
35
35
void EthernetClass::begin (uint8_t *mac_address, IPAddress local_ip)
36
+ {
37
+ // Assume the DNS server will be the machine on the same network as the local IP
38
+ // but with last octet being '1'
39
+ IPAddress dns_server = local_ip;
40
+ dns_server[3 ] = 1 ;
41
+ begin (mac_address, local_ip, dns_server);
42
+ }
43
+
44
+ void EthernetClass::begin (uint8_t *mac_address, IPAddress local_ip, IPAddress dns_server)
36
45
{
37
46
// Assume the gateway will be the machine on the same network as the local IP
38
47
// but with last octet being '1'
39
48
IPAddress gateway = local_ip;
40
49
gateway[3 ] = 1 ;
41
- begin (mac_address, local_ip, gateway);
50
+ begin (mac_address, local_ip, dns_server, gateway);
42
51
}
43
52
44
- void EthernetClass::begin (uint8_t *mac_address, IPAddress local_ip, IPAddress gateway)
53
+ void EthernetClass::begin (uint8_t *mac_address, IPAddress local_ip, IPAddress dns_server, IPAddress gateway)
45
54
{
46
55
IPAddress subnet (255 , 255 , 255 , 0 );
47
- begin (mac_address, local_ip, gateway, subnet);
56
+ begin (mac_address, local_ip, dns_server, gateway, subnet);
48
57
}
49
58
50
- void EthernetClass::begin (uint8_t *mac, IPAddress local_ip, IPAddress gateway, IPAddress subnet)
59
+ void EthernetClass::begin (uint8_t *mac, IPAddress local_ip, IPAddress dns_server, IPAddress gateway, IPAddress subnet)
51
60
{
52
61
W5100.init ();
53
62
W5100.setMACAddress (mac);
54
63
W5100.setIPAddress (local_ip._address );
55
64
W5100.setGatewayIp (gateway._address );
56
65
W5100.setSubnetMask (subnet._address );
66
+ _dnsServerAddress = dns_server;
57
67
}
58
68
59
69
IPAddress EthernetClass::localIP ()
0 commit comments