Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitee2590e

Browse files
authored
Merge pull request#756 from JAndrassy/sockethlp_dnsipn
SocketHelpers - added dnsIP(n) getter as in WiFi libraries
2 parents7bc601c +11cdf0a commitee2590e

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

‎libraries/SocketWrapper/src/SocketHelpers.cpp‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ arduino::IPAddress arduino::MbedSocketClass::dnsServerIP() {
5050
returnipAddressFromSocketAddress(ip);
5151
}
5252

53+
arduino::IPAddressarduino::MbedSocketClass::dnsIP(int n) {
54+
SocketAddress ip;
55+
NetworkInterface* interface =getNetwork();
56+
interface->get_dns_server(n, &ip,nullptr);
57+
returnipAddressFromSocketAddress(ip);
58+
}
59+
5360
voidarduino::MbedSocketClass::config(arduino::IPAddress local_ip) {
5461
nsapi_addr_t convertedIP = { NSAPI_IPv4, { local_ip[0], local_ip[1], local_ip[2], local_ip[3] } };
5562
_ip =SocketAddress(convertedIP);

‎libraries/SocketWrapper/src/SocketHelpers.h‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,13 @@ class MbedSocketClass {
9999
*/
100100
IPAddressdnsServerIP();
101101

102+
/*
103+
* Get the DNS Server ip address.
104+
*
105+
* return: DNS Server ip address value
106+
*/
107+
IPAddressdnsIP(int n =0);
108+
102109
virtual NetworkInterface*getNetwork() = 0;
103110

104111
intdownload(char* url,constchar* target,boolconst is_https =false);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp