Right, it's just a big problem with pickle because if you do a recv at the wrong time and try to load it with pickle, you'll start getting weird errors down in the pickle module as opposed to just not getting the full string you expected if you were using plaintext strings. This is probably me being spoiled from Java, but they built a stream class that can be used for files, networks, and many other things while hiding nasty details like this. It seems like Python could really benefit from this kind of architecture. Of course, there's probably already something out there that I just don't know about.
-Walker On 7/20/07, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote:
On Fri, 20 Jul 2007 08:27:13 -0700, Walker Lindley <[EMAIL PROTECTED]> wrote: >It doesn't interface well because the string you end up with often doesn't >fit into a single packet. Therefore you have to add a layer of protocol on >top of it that allows you to check to make sure you have the whole string >received before trying to unpickle it. This the case even if you use >socket's makefile() method to make a file descriptor. This is somewhat misleading. TCP doesn't guarantee any minimum packet size larger than a single byte. Any messaging system which uses strings longer than one byte must have a framing protocol to be reliable. So, this isn't really specific to pickle. Basically, all protocols have to address this. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list
-- This e-mail is licensed under the Creative Commons Attribution-NoDerivs 2.5License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nd/2.5/ or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA. -- This e-mail is licensed under the Creative Commons Attribution-NoDerivs 2.5License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nd/2.5/ or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA.
-- http://mail.python.org/mailman/listinfo/python-list