2012-03-06 98 views
-1

我正在開發多人遊戲。原理很簡單,每個玩家每隔50毫秒週期性發送512個字節。使用UDP時路由器無響應

問題是,大約每20-30秒,玩家停止接收數據,有時甚至達到20秒(儘管發送並未中斷)。

起初我以爲這是由我的遠程PC上我用來調試的網絡連接速度慢造成的。

但是後來我注意到,當遊戲停止接收數據時,我身邊的所有網絡流量都在同一時間變慢。

於是我開始ping <my-local-router>,這就是它顯示我:

 
When the game isn't running: 
... 
64 bytes from 192.168.1.1: icmp_req=4520 ttl=64 time=4.89 ms 
64 bytes from 192.168.1.1: icmp_req=4521 ttl=64 time=7.96 ms 
64 bytes from 192.168.1.1: icmp_req=4522 ttl=64 time=10.5 ms 
64 bytes from 192.168.1.1: icmp_req=4523 ttl=64 time=7.21 ms 
64 bytes from 192.168.1.1: icmp_req=4524 ttl=64 time=8.10 ms 
64 bytes from 192.168.1.1: icmp_req=4525 ttl=64 time=3.37 ms 
64 bytes from 192.168.1.1: icmp_req=4526 ttl=64 time=5.12 ms 
64 bytes from 192.168.1.1: icmp_req=4527 ttl=64 time=3.29 ms 
... 
 
When the game is running: 
... 
64 bytes from 192.168.1.1: icmp_req=47 ttl=64 time=6.99 ms 
64 bytes from 192.168.1.1: icmp_req=48 ttl=64 time=1.69 ms 
64 bytes from 192.168.1.1: icmp_req=49 ttl=64 time=2.60 ms 
64 bytes from 192.168.1.1: icmp_req=50 ttl=64 time=2.88 ms 
64 bytes from 192.168.1.1: icmp_req=52 ttl=64 time=9210 ms 
64 bytes from 192.168.1.1: icmp_req=53 ttl=64 time=17144 ms 
64 bytes from 192.168.1.1: icmp_req=54 ttl=64 time=16214 ms 
64 bytes from 192.168.1.1: icmp_req=55 ttl=64 time=15372 ms 
64 bytes from 192.168.1.1: icmp_req=56 ttl=64 time=14482 ms 
64 bytes from 192.168.1.1: icmp_req=57 ttl=64 time=13486 ms 
64 bytes from 192.168.1.1: icmp_req=58 ttl=64 time=12511 ms 
64 bytes from 192.168.1.1: icmp_req=59 ttl=64 time=11546 ms 
64 bytes from 192.168.1.1: icmp_req=60 ttl=64 time=10591 ms 
64 bytes from 192.168.1.1: icmp_req=61 ttl=64 time=9626 ms 
64 bytes from 192.168.1.1: icmp_req=62 ttl=64 time=1.34 ms 
64 bytes from 192.168.1.1: icmp_req=63 ttl=64 time=3.33 ms 
... 

看來,遊戲是造成路由器停止響應。

我沒有任何P2P在我的本地PC上運行,但這甚至沒有聲音相關性,因爲當遊戲沒有運行時我沒有經歷減速。

我是UDP編程的新手,我對此一無所知,尤其是因爲每50ms 512個字節對​​我來說似乎有相當小的帶寬(當我運行P2P時,它可以輕鬆運行1.5MB/s) 。

回答

0

這可能是我的路由器死亡,需要替換或在我的無線驅動程序中有些腥意,因爲我注意到,即使在應用程序未運行時,最近網絡也會凍結。