OHLÁLÁ OHLÁLÁ - 3 years ago 348
Python Question

Python sending dictionary throught TCP

I'm a python beginner, and I'm curious how can I send a dictionary through TCP

Answer Source

You should serialize it with pickle:

import pickle
dict = {...}

And on the other end:

import pickle
dict = pickle.loads(tcp_recieve())

If the other end is not written in python, you can use a data serialization format, like xml, json or yaml.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download