Gregory (Grisha) Trubetskoy
grisha at modpython.org
Tue Jul 1 12:12:58 EST 2003
On Tue, 1 Jul 2003, Robert Sanderson wrote: > > I think your only option is to read a byte at a time, making sure that > > when you receivie a complete frame/packet/whatever you stop reading so as > > to not block indefinitely. > > Yep, I've now successfully implemented a Z39.50 connection handler using > mod_python and PyZ3950 under Apache Cool (even though I don't know what Z39.50 is :-) ) > using this technique, though it's not pretty having to try to parse a > PDU after reading in each byte. This is a pretty common technique in C, but in Python it is definitely very inefficient because every "byte" is really a string... You could probably get some improvement from using Python buffer(). I imagine this will be a fairly common problem for people who implement connections, so if you have any ideas on how it can be improved, please be sure to share them on the list. Grisha
|