ruby使用UDPSocket的recvfrom方法,通信变得很慢

When doing data, addr = @socket.recvfrom(1500), the addr array contains Array: ["AF_INET", port, "resolved-name-or-ip", "ip"]

创新互联专注于中大型企业的网站建设、成都网站设计和网站改版、网站营销服务,追求商业策划与数据分析、创意艺术与技术开发的融合,累计客户上1000+,服务满意度达97%。帮助广大客户顺利对接上互联网浪潮,准确优选出符合自己需要的互联网运用,我们将一直专注高端网站设计和互联网程序开发,在前进的路上,与客户一起成长!

How can I disable resolving on UDPSocket? The documentation for ruby UDPSocket is bit poor.

Ok. I found it.

I'll document this here so someone might get lucky and find it.

To disable automatic lookups, put this in your code:

BasicSocket.do_not_reverse_lookup = true

before you create the socket. It does the trick.


文章题目:ruby使用UDPSocket的recvfrom方法,通信变得很慢
文章来源:http://azwzsj.com/article/picegg.html