#NEWLINE# @ idiokit . stream #NEWLINE# def decode( sock ) : #NEWLINE# #INDENT# while True : #NEWLINE# #INDENT# length_bytes = ( yield recvall ( sock , 4 ) ) #NEWLINE# ( length , ) = struct . unpack ( '!I' , length_bytes ) #NEWLINE# msg_bytes = ( yield recvall ( sock , length ) ) #NEWLINE# msg = cPickle . loads ( msg_bytes ) #NEWLINE# ( yield idiokit . send ( sock ) )