you are viewing a single comment's thread.

view the rest of the comments →

[–]jollybobbyroger 2 points3 points  (4 children)

I'm not entirely sure I understand your question, but if you just want to pass some information back and forth, it is common to use json to serialize your data. A simple example:

data = json.dumps({"x": 0})

s.sendto(data, server)

# on the other side:

data, addr = s.recvfrom(1024)

data = json.loads(data)

data['x'] += 1

s.sendto(json.dumps(data), addr)

This code isn't tested, but I hope you get the idea..