How to receive a data file of unknown length using a python socket?

python at bdurham.com python at bdurham.com
Sun Jul 19 09:18:21 EDT 2009


Hi Hendrik,

> I have ended up writing a netstring thingy, that addresses the string transfer problem by having a start sentinel, a four byte ASCII length (so you can see it with a packet sniffer/displayer) and the rest of the data escaped to take out the start sentinel and the escape character. It works, but the four byte ASCII limits the size of what can be sent and received. It guarantees to deliver either the whole string, or fail, or timeout.

> If anybody is interested I will attach the code here. It is not a big module.

I am interested in seeing your code and would be grateful if you shared
it with this list.

Thank you,
Malcolm



More information about the Python-list mailing list