strange sockets

Jim Segrave jes at
Fri Nov 4 18:15:22 CET 2005

In article <dkfqhb$l1l$1 at>, Skink  <spam at me.please> wrote:
>I'm preparing a python server that sends java classes and resources to
>custom java class loader. In order to make it faster I don't want to use
>URLClassLoader that uses HTTP protocol 1.0 and for each class/resource
>creates own connection.
>Instead I'd like to use raw sockets with simple protocol:
> - class loader sends a line terminated with \n with resource to get
> - python server reads that line, gets the file and sends back an
>integer with file length and then the file itself
> - class loader reads a lenght integer and then reads the remainig data
>The problem is when I try to read several files the first one is read
>quite fast, but the rest is read 40 x slower. For example (time is in
>% python
>init 0.00066089630127
> 0.000954866409302
> 0.0408389568329
> 0.0409188270569
> 0.0409059524536
> 0.0409259796143
>what's wrong here?

At a guess, what you've measured is how long it takes to transfer the
data to the underlying OS socket buffers. The first transfer fills the
buffers, subsequent ones have to wait until the data has been put on
the wire and acknowledged before there's space for the writes. 

Jim Segrave           (jes at

More information about the Python-list mailing list