开发者

python:send class object in socket.sendto()

开发者_JAVA百科

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜