用于延迟测试的客户端-服务器时间同步(套接字)
我想使用 UDP 然后使用 TCP 来测量一个简单程序的延迟。我目前正在两端使用时间库中的 time.time() 并比较它们(在服务器发送之前的时间戳和在客户端接收之后的时间)。服务器将发送其时间戳,接收器将比较时间以计算延迟。 使用 127.0.0.1 环回地址时效果很好。由于在同一台机器上,时间参考是相同的。 如果我在服务器和客户端分开的实际应用程序上实现此功能,我将无法获得准确的延迟,因为两台机器之间存在时间差。
有没有办法同步时间以更好地计算延迟?
另外,当我的数据速率很高且接收后处理适中时,如何始终保持低UDP延迟?客户端的距离会影响延迟吗?
谢谢
I want to measure the latency for a simple program using UDP then TCP. I am currently using time.time() from time library at both ends and I compare them (time stamp before sending at the server and time after recieving at the client). The server would send its time stamp and the reciever will compare the time to calculate latency.
This worked fine when using 127.0.0.1 loopback address. Since its on the same machine, time reference is the same.
if I implement this on my actual application where the server and client are seperate, I can't get the accurate latency since there is a time difference between the two machine.
Is there a way to synchronize time for better latency calcultaion?
Also, how do I maintain low UDP latency all the time when I have high data rate and moderate processing fter receiving? and will the client's distance affect latency?
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论