Reputation: 9634
I am writing a simple chat application in Python. As part of that, I was wondering what is the best method to send custom objects from the server to the client. I believe there are three methods that are widely used:
Is there any other method that can be used which beats the above mentioned? If not, which is the best method among the three?
Upvotes: 1
Views: 363
Reputation: 69062
Don't use pickle. Using pickle in a client-server application would mean to unpickle data from untrusted sources. If you look at the pickle documentation, there's a big red warning about that on top of the page. Basically, pickle is unsecure, and by unpickling arbitrary pickled data you risk allowing anyone to run custom code on your server and clients.
Choose a data exchange format you're comfortable with, doesn't really matter if it's xml, json, a custom protocol, etc... But pickle isn't designed for data exchange.
Upvotes: 2