@@ -33,27 +33,37 @@ int EthernetClass::begin(uint8_t *mac_address)
3333}
3434
3535void 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)
3645{
3746 // Assume the gateway will be the machine on the same network as the local IP
3847 // but with last octet being '1'
3948 IPAddress gateway = local_ip;
4049 gateway[3 ] = 1 ;
41- begin (mac_address, local_ip, gateway);
50+ begin (mac_address, local_ip, dns_server, gateway);
4251}
4352
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)
4554{
4655 IPAddress subnet (255 , 255 , 255 , 0 );
47- begin (mac_address, local_ip, gateway, subnet);
56+ begin (mac_address, local_ip, dns_server, gateway, subnet);
4857}
4958
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)
5160{
5261 W5100.init ();
5362 W5100.setMACAddress (mac);
5463 W5100.setIPAddress (local_ip._address );
5564 W5100.setGatewayIp (gateway._address );
5665 W5100.setSubnetMask (subnet._address );
66+ _dnsServerAddress = dns_server;
5767}
5868
5969IPAddress EthernetClass::localIP ()
0 commit comments