Tag: DNS

如何在iOS中以编程方式更改/添加连接的WiFi的DNS服务器?

我想以编程方式在iOS中为我的iPhone设备的连接WiFi更改/添加DNS服务器? Google Public DNS IP地址(IPv4)如下:8.8.8.8 8.8.4.4 我想改变/添加它像附件截图编程。 请帮忙。 我可以pipe理它是否在Objective-c或Swift中。 Objective-c对我来说会更有帮助。 提前致谢。 连接Wi-Fi的虚拟/旧DNS服务器: – 连接的Wi-Fi所需的DNS服务器: –

使用公共DNS服务器的iOS替代CFHostStartInfoResolution?

我的应用程序似乎大多数时间工作正常。 但是,当它在中国运行时,它有时会给我我的服务器的IP地址。 我用这个来asynchronous获取IP地址: //… CFStringRef hostAddress = CFStringCreateWithCString( kCFAllocatorDefault, hostAddressStr, kCFStringEncodingASCII ); CFHostRef theHostRef = CFHostCreateWithName( kCFAllocatorDefault, hostAddress ); CFRelease(hostAddress); CFHostClientContext context; context.version = 0; context.retain = nil; context.release = nil; context.copyDescription = nil; context.info = self; Boolean set_ok = CFHostSetClient( theHostRef, myCFHostClientCallBack, &context ); CFStreamError cfError; CFHostScheduleWithRunLoop( theHostRef, CFRunLoopGetCurrent(), kCFRunLoopCommonModes); Boolean is_resolving = CFHostStartInfoResolution( […]

iOS – 在仅IPv6networking上获取设备的DNS服务器地址

我正尝试在连接到iOS上的IPv6唯一networking时获取设备的DNS服务器地址。 以下代码适用于连接到IPv4networking但在IPv6networking上不起作用的情况。 来自这个答案的代码。 res_ninit(&_res); res_state res = &_res; for (int i=0; i < res->nscount; i++) { sa_family_t family = res->nsaddr_list[i].sin_family; if (family == AF_INET) { NSLog(@"IPv4"); char str[INET_ADDRSTRLEN]; // String representation of address inet_ntop(AF_INET, & (res->nsaddr_list[i].sin_addr.s_addr), str, INET_ADDRSTRLEN); } else if (family == AF_INET6) { NSLog(@"IPv6"); char address[INET6_ADDRSTRLEN]; // String representation of address inet_ntop(AF_INET6, &(res->nsaddr_list […]

从iPhone设置获取DNS服务器IP

我试图find一个方法如何让我的DNS服务器IP出现在settings->无线 – >细节 – > DNS。 我不知道苹果是否允许以编程方式获取此信息。