[Tutor] Data exchange formats...

Modulok modulok at gmail.com
Mon Jun 21 01:01:12 CEST 2010


What's the best format to send data across the wire between processes?

I have some simple 'insensitive' data I need to send from a client, to
a server via a TCP socket. Things like 'count = 10, name="foo"' and so
forth. Basic values. I would use something like the 'pickle' module to
pack them up send as encoded strings, which would then be loaded on
the server. It'd be nice, but the server has no authentication.

"Warning The pickle module is not intended to be secure against
erroneous or maliciously constructed data. Never unpickle data
received from an untrusted or unauthenticated source."

Currently I'm sending strings and using regular expressions on the
server to pluck out the needed data, but thought there must be
something cleaner, nicer and better. Ideas?

More information about the Tutor mailing list