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

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

創(chuàng)新互聯(lián)專注于中大型企業(yè)的網(wǎng)站建設(shè)、成都網(wǎng)站設(shè)計(jì)和網(wǎng)站改版、網(wǎng)站營銷服務(wù),追求商業(yè)策劃與數(shù)據(jù)分析、創(chuàng)意藝術(shù)與技術(shù)開發(fā)的融合,累計(jì)客戶上1000+,服務(wù)滿意度達(dá)97%。幫助廣大客戶順利對(duì)接上互聯(lián)網(wǎng)浪潮,準(zhǔn)確優(yōu)選出符合自己需要的互聯(lián)網(wǎng)運(yùn)用,我們將一直專注高端網(wǎng)站設(shè)計(jì)和互聯(lián)網(wǎng)程序開發(fā),在前進(jìn)的路上,與客戶一起成長!

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.

當(dāng)前文章:ruby使用UDPSocket的recvfrom方法,通信變得很慢
網(wǎng)站路徑:http://muchs.cn/article16/picegg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站制作、域名注冊(cè)、商城網(wǎng)站、虛擬主機(jī)企業(yè)網(wǎng)站制作、做網(wǎng)站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

網(wǎng)站托管運(yùn)營