This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Thorben
Recipients Thorben, giampaolo.rodola, pitrou, thorben
Date 2008-09-11.17:50:37
SpamBayes Score 2.9382052e-13
Marked as misclassified No
Message-id <3b5d765a0809111050y1432ce41gd87cd8cc58f0db7f@mail.gmail.com>
In-reply-to <20449_1221150334_m8BGPXWL020865_1221150332.52.0.767637122156.issue3766@psf.upfronthosting.co.za>
Content
2008/9/11 Antoine Pitrou <report@bugs.python.org>:
>
> Antoine Pitrou <pitrou@free.fr> added the comment:
>
> You can use setsockopt() to set the TCP_NODELAY flag and see if that
> improves things; sending thousands of 4-bytes packets isn't exactly the
> expected utilization of TCP.

You are obviously right, but IIRC, I mentioned that this is simply a
dummy testcase...

now thats interesting:
adding the line "sock.setsockopt(SOL_TCP, TCP_NODELAY, 1) " decreased
the delay by half. It still is extremely high but it's a start.

Do you think I could get that value down much further? I don't know
much about TCP...

> As I said, socket.recv() is just a thin wrapper above the same-named C
> library function. Your code expects the kernel's TCP stack to send
> things as soon as you ask it to, but TCP is a high-level stream protocol
> and implementations usually have sophisticated algorithms in order to
> minimize the number of individual packets sent over the wire.

Would be interesting to examine the differences between the Perl
wrapper and the Python wrapper to figure out why Perl "does the right
thing" in this case and Python doesn't.

> By the way, if you want to build network applications (clients and
> servers), I suggest you take a look at the Twisted framework. It will
> free you from many low-level issues, although it won't prevent you from
> shooting yourself in the foot :-)

Thanks, I'll make sure to try it out.

> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue3766>
> _______________________________________
>
History
Date User Action Args
2008-09-11 17:50:54Thorbensetrecipients: + Thorben, pitrou, giampaolo.rodola, thorben
2008-09-11 17:50:38Thorbenlinkissue3766 messages
2008-09-11 17:50:37Thorbencreate