views:

208

answers:

1

Hi! 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%5Fid=554172&whichpage=1&#3572589

+1  A: 

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.

noah
+1: TCP Buffers. If they don't want buffering, perhaps they should be using UDP.
S.Lott
Well, there's nothing in the TCP standard that says the kernel has to buffer, but they all do because sending a packet of less than a few k is pretty inefficient.
noah