开发者

How do I disable Nagle's algorithm for sockets?

开发者 https://www.devze.com 2022-12-14 03:46 出处:网络
I\'m writing some python and are stuck at the moment. I think this \"Nagle algoritm\" is the problem since my packages are delayed some time for some reason to the client.

I'm writing some python and are stuck at the moment. I think this "Nagle algoritm" is the problem since my packages are delayed some time for some reason to the client.

I've tried this on both client and server but it doesn't seems to work (or there's another problem causing it):

socketobj.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)

Any ideas?

EDIT: A full explanation of my problem can be found here: http://www.gamedev.net/community/forums/topic.asp?topic_id=554172&which开发者_开发技巧page=1&#3572589


I'm not familiar with Python's sockets, but does it have a flush method? Even with Nagle's disabled, most socket implementations will buffer if you don't write X number of bytes. However, if you call flush, the bytes should be sent immediately.

0

精彩评论

暂无评论...
验证码 换一张
取 消