Ethernet.setDnsServerIP()

名称

Ethernet.setDnsServerIP()

説明

DNSサーバのIPアドレスを設定する。DHCPのときは利用しない。

書式

void EthernetClass::setDnsServerIP(const IPAddress dns_server);

引数

dns_serverDNSサーバのIPアドレス。

戻り値

なし。

使用例

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
#include <SPI.h>
#include <Ethernet.h>

byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
IPAddress ip(10, 0, 0, 177);
IPAddress myDns(192, 168, 1, 1);

void setup() {
  Ethernet.begin(mac, ip, myDns);
  IPAddress newDns(192, 168, 1, 1);
  Ethernet.setDnsServerIP(newDns);  // change the DNS server IP address
}

void loop () {}

オリジナルのページ

https://www.arduino.cc/reference/en/libraries/ethernet/ethernet.setdnsserverip/

最終更新日

January 7, 2024

inserted by FC2 system