I want to send a class object in socket.sendto(classObject , (host , port)).
Basically I want to send some more information with the message.How can I do this.
You can't. Serialize the data before attempting to send it.
Use bits = pickle.dumps(classObject)
to send data into socket.sendto(bits , (host , port))
.
And use classObject = pickle.loads(bits)
to get the object after.
精彩评论