NSStream-反向DNS查找错误 [英] NSStream - reverse DNS lookup error

查看:105
本文介绍了NSStream-反向DNS查找错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须将NSStream打开到只有数字地址而不是名称的wifi接入点. NSStream需要30-40秒才能打开套接字.在实验中,我发现从Windows盒远程登录到AP是瞬时的,但是在Mac上,则是30-40秒.在研究telnet时,我发现在Mac上的实现有所不同,因为它默认情况下会尝试进行名称查找.阅读telnet的手册页,我发现: -N防止在将目标主机指定为IP地址时使用IP地址命名查找.

I have to open an NSStream to a wifi access point that has only a numerical address, not a name. It takes NSStream 30-40 seconds to open a socket. In experimenting, i found that telnet-ing to the AP from a windows box was instantaneous, but on a mac, connecting the same 30-40 seconds. in researching telnet, i found that the implementation is a little different on a mac, in that it by default tries to to a name lookup. reading the manual page for telnet, i found: -N Prevents IP address to name lookup when destination host is given as an IP address.

当我使用"telnet -N IP地址端口"时,我的连接是瞬时的!我怀疑相同的问题正在导致我的NSStream连接延迟.有什么方法可以等同于在NSStream中设置"-N"标志吗?

when I used "telnet -N IP-address port", my connection was instantaneous! I suspect that this same problem is causing the delay in my NSStream connection. Is there any way to do the equivalent of setting the"-N" flag in NSStream?

推荐答案

NSHost在Cocoa Touch上似乎不可用,因此您无法强制使用给定地址的主机,尽管我不知道这是否否定了需求进行dns查找.

It looks like NSHost is not available on Cocoa Touch, so you cannot force a host with a given address, though I don't know if that negates the need for a dns lookup.

自2005年以来,这个问题就一直存在,尽管这可能不适用于Cocoa Touch库.无论如何,都没有给定的解决方案:

This problem has been around since 2005, though this might not apply to Cocoa Touch libraries. In any case there is no given solution:

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆