Probel with socket "recv" function on Win2000

Fredrik Lundh fredrik at pythonware.com
Mon Feb 14 11:58:19 EST 2005


Guy Machlev wrote:

> I have a problem with the socket recv() function while using it on
> win-2000, the problem accrue while receiving data from socket in a
> constant format (e.g. 1Byte then 4Bytes and then number of bytes
> according to the previous 4Bytes number), this receiving action "fail"
> after a bout ~120Kbytes of data the, actually the phenomena that accrue
> after reading this amount of data is a kind of data skipping which mean
> that the next recv is reading data start from ~121Kbytes I am losing
> data between the 120 and 121, this phenomena is consistently happened
> exactly at the same data point. I have tried to run the same script on
> Linux and there it went perfect.
>
> anyone has any idea way it happened ?

TCP or UDP?

are you checking the length of the buffers you get back from recv?

are you sure it's skipping and not just getting out of sync?

does replacing the recv() with read() on a socket stream (use makefile()
to create the stream) help?

</F> 






More information about the Python-list mailing list