简体   繁体   English

TCP消息“启动”

[英]TCP Messages 'Bunching Up'

I'm writing a multiplayer Flash game, and the server is written in Python and it updates 25 times a second. 我正在编写一个多人Flash游戏,并且服务器是用Python编写的,并且每秒更新25次。 Every update, if a player is moving, the server sends out TCP messages containing the new positions of that player. 每次更新时,如果有玩家在移动,服务器都会发出包含该玩家新位置的TCP消息。 Running locally, everything was lovely, but I've recently pushed the code to a higher-spec deployment server (with a 100Mbps pipe connection) to test how it plays. 在本地运行,一切都很好,但是我最近将代码推送到了更高规格的部署服务器(具有100Mbps管道连接)以测试其运行方式。

I'm glad I did, because what I am noticing is that these update messages are bunching up during sending and they arrive in six's. 我很高兴,因为我注意到这些更新消息在发送过程中聚集在一起,并且到达六位。 Testing locally, the messages were arriving at 1/25th of a second intervals, and so player movement was very smooth, now it really isn't. 在本地进行测试,消息以每秒1/25秒的间隔到达,因此播放器的移动非常流畅,但实际上并非如此。

If you had this same issue, what are the things you would look at, experiment with, in order to find a solution? 如果您遇到同样的问题,为了寻找解决方案,您会尝试什么东西?

You can try disabling Nagle's algorithm to make sure segments are sent straight away. 您可以尝试禁用Nagle的算法 ,以确保立即发送段。 However, given your requirements, I wonder if UDP isn't a better match. 但是,根据您的要求,我想知道UDP是否不是更好的匹配。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM