serializing data structures

Paul Rubin http
Mon Jan 31 18:55:01 EST 2005


"Philippe C. Martin" <philippecmartin at sbcglobal.net> writes:
> I am trying to figure out the traps/issues about sending data structures
> through a TCP/IP socket under the following circumstances:
> 
> 1) there could be a different O/S on both side of the socket
> 2) there could be a difference CPU architecure on both side of the
> socket
> 3) there could be a different major release of python (ex 2.3 and 2.4)
> on both side of the socket.
> 
> I once wrote something in C to do that, but since python usually has a
> solution for me ....

What do you mean by data structures?  If they're limited to basic
objects like strings and ints, try xdrlib.  If you want longs, class
instances, etc., there's really no good way in the Python stdlib that
doesn't create security vulnerabilities if the source of data isn't
trusted.  See SF bugs 471893 and 467384 for some discussion.



More information about the Python-list mailing list