Changeset 77 for trigger/communication.py
- Timestamp:
- 06/30/09 11:09:39 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trigger/communication.py
r52 r77 9 9 unmarshall = cPickle.loads 10 10 11 def send(channel, *args): 12 buf = marshall(args) 13 value = socket.htonl(len(buf)) 14 size = struct.pack("L",value) 15 channel.send(size) 11 def send(channel, args): 12 #print "will send: ", args 13 args+="\n" 14 buf = args #marshall(args) 15 #value = socket.htonl(len(buf)) 16 value = str(len(buf)) 17 #size = struct.pack("i",value) 18 print "length: ",len(buf) 19 #print "SIZE: ",repr(size) 20 #channel.send(value) 21 buf+="\0" 16 22 channel.send(buf) 17 23 #print 'sending: ',buf 24 #print 'sent' 18 25 def receive(channel): 19 26 20 27 size = struct.calcsize("L") 21 28 size = channel.recv(size) 29 print "rec size: ",size 22 30 try: 23 size = socket.ntohl(struct.unpack("L", size)[0]) 31 size = socket.ntohl(struct.unpack("i", size)[0]) 32 #print "unpacked: ",size 24 33 except struct.error, e: 25 34 return ''
Note:
See TracChangeset
for help on using the changeset viewer.