Example #1
0
def send_response(stream):
    print 'starting response'
    stream.write('there is no spoon\n', with_args(read_response, stream))
Example #2
0
def read_response(stream):
    print 'reading'
    stream.read_until_close(with_args(consume_result, stream))
Example #3
0
 def _consume_len(self, data, stream, callback):
     length = int(data)
     stream.read_bytes(length, with_args(self._consume_data, callback))
Example #4
0
 def deserialize(self, stream, callback):
     stream.read_until(' ', with_args(self._consume_len, stream, callback))
Example #5
0
def echo_handler(stream, address):
    print "Connection Received:", stream, "from", address
    stream.read_until('\n', with_args(echo_responder, stream))