um.... out of ignorance?
to be honest, I'm a bit fuzzy as to how to choose between the two.
User Profile
Collapse
-
hokay, solved it. Brak it into chunks and send 'em.
The server launches the client .py
server snippet:
...Code:mysocket = socket(AF_INET,SOCK_DGRAM) mysocket.bind(addr) #launch client.py clientthread().start() pkl_str = "" Dlen = mysocket.recv(buf) for i in range(0,int(int(Dlen)/buf)+1): data = mysocket.recv(buf) pkl_str +=data dict = pickle.loads(pkl_str)Leave a comment:
-
also, security is not an issue, I am aware of the security issues.
Here's some code fragments:
my sample pickle returns len(pkl_split) = 45499Code:pkl_dict = cPickle.dumps(heir_dict) pkl_split = pkl_dict.split("\n") print len(pkl_split) i = 0 for line in pkl_split: i += 1 print str(i)+" "+line mysocket.send(line)
...Leave a comment:
-
sending pickled dictionary over a socket
I saw this thread:
http://bytes.com/topic/python/answers/553952-sending-dictionary-via-network
which works nicely for tiny dictionaries, but my sample pickled dictionary is about 500,000 characters long, and this method doesn't work. I tried splitting the dictionary on \n and then joining it, but the sockets hang after a coupla thousand lines.
Surely, passing a dictionary over a socket must be a fairly common...
No activity results to display
Show More
Leave a comment: