本文整理汇总了C++中DNSClient::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ DNSClient::begin方法的具体用法?C++ DNSClient::begin怎么用?C++ DNSClient::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DNSClient
的用法示例。
在下文中一共展示了DNSClient::begin方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dnsLookup
//convert a hostname to an ip address
int GroveStreams::dnsLookup(const char* hostname, IPAddress& addr)
{
int ret = 0;
DNSClient dns;
dns.begin(Ethernet.dnsServerIP());
ret = dns.getHostByName(hostname, addr);
return ret;
}
示例2: connect
int EthernetClient::connect(const char* host, uint16_t port) {
// Look up the host first
int ret = 0;
DNSClient dns;
IPAddress remote_addr;
dns.begin(Ethernet.dnsServerIP());
ret = dns.getHostByName(host, remote_addr);
if (ret == 1) {
return connect(remote_addr, port);
} else {
return ret;
}
}
示例3: connect
int EthernetClient::connect(const char* host, uint16_t port)
{
int ret = 0;
DNSClient dns;
IPAddress remote_addr;
IPAddress dns_server;
dns.begin(Ethernet.dnsServerIP());
ret = dns.getHostByName(host, remote_addr);
if (ret == 1)
return connect(remote_addr, port);
return ret;
}
示例4: iClient
HttpClient::HttpClient(Client& aClient, const char* aProxy, uint16_t aProxyPort)
: iClient(&aClient), iProxyPort(aProxyPort)
{
resetState();
if (aProxy)
{
// Resolve the IP address for the proxy
DNSClient dns;
dns.begin(Ethernet.dnsServerIP());
// Not ideal that we discard any errors here, but not a lot we can do in the ctor
// and we'll get a connect error later anyway
(void)dns.getHostByName(aProxy, iProxyAddress);
}
}
示例5: beginPacket
int EthernetUDP::beginPacket(const char *host, uint16_t port)
{
// Look up the host first
int ret = 0;
DNSClient dns;
IPAddress remote_addr;
dns.begin(Ethernet.dnsServerIP());
ret = dns.getHostByName(host, remote_addr);
if (ret == 1)
return beginPacket(remote_addr, port);
else
return ret;
}
示例6: connect
int EthernetClient::connect(const char * host, uint16_t port)
{
DNSClient dns; // Look up the host first
IPAddress remote_addr;
if (sockindex < MAX_SOCK_NUM) {
if (Ethernet.socketStatus(sockindex) != SnSR::CLOSED) {
Ethernet.socketDisconnect(sockindex); // TODO: should we call stop()?
}
sockindex = MAX_SOCK_NUM;
}
dns.begin(Ethernet.dnsServerIP());
if (!dns.getHostByName(host, remote_addr)) return 0; // TODO: use _timeout
return connect(remote_addr, port);
}
示例7: connect
/**
* @brief
* @note
* @param
* @retval
*/
int UIPClient::connect(const char* host, uint16_t port) {
// Look up the host first
int ret = 0;
#if UIP_UDP
DNSClient dns;
IPAddress remote_addr;
dns.begin(UIPEthernetClass::_dnsServerAddress);
ret = dns.getHostByName(host, remote_addr);
if(ret == 1) {
return connect(remote_addr, port);
}
#endif
return ret;
}