私はマルチプレイヤーゲームで作業しています。原理は単純で、2人のプレーヤーのそれぞれは、50ミリ秒毎に512バイトを互いに定期的に送る。UDPを使用しているとルーターが応答しなくなる
問題は約20〜30秒ごとにデータが受信されなくなることがありますが、時には1秒間、時には最大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 ...
ゲームは、ルータが応答しなくなる原因となっているようです。
ローカルPCでP2Pを実行していませんが、ゲームが実行されていないときにスローバックが発生しないため、関連するサウンドは出力されません。
私はUDPプログラミングの新人です。これは特に50msごとの512バイトが私にとってはかなり小さい帯域幅のように見えるので、私はこれでうんざりしています(私はP2Pを実行すると1.5MB/sを簡単に実行します) 。