Did I find the right examples for you? yes no

All Samples(6)  |  Call(6)  |  Derive(0)  |  Import(0)

        def line_protocol(socket, strip=True):
    fileobj = socket.makefile()
    while True:
        try:
            line = fileobj.readline() # returns None on EOF
            if line is not None and strip:
                line = line.strip()
        except IOError:
            line = None
        if line:
            yield line
        else:
            break
        


src/m/i/miyamoto-HEAD/miyamoto/cluster.py   miyamoto(Download)
            keepalive = gevent.spawn_later(5, lambda: client.send('\n'))
            try:
                for line in util.line_protocol(client, strip=False):
                    if line == '\n':
                        # Keepalive ack from leader
            self._update(add={'host': address[0], 'socket': socket})
            timeout = gevent.spawn_later(10, lambda: self._shutdown(socket))            
            for line in util.line_protocol(socket, strip=False):
                timeout.kill()
                timeout = gevent.spawn_later(10, lambda: self._shutdown(socket))

src/m/i/miyamoto-HEAD/miyamoto/scheduler.py   miyamoto(Download)
    def _add_peer(self, host):
        client = gevent.socket.create_connection((host, self.port), source_address=(self.interface, 0))
        self.connections[host] = client
        for line in util.line_protocol(client):
            ack, task_id = line.split(':', 1)
    def _backend_server(self, socket, address):
        for line in util.line_protocol(socket):
            action, payload = line.split(':', 1)
 
            if action == 'schedule':

src/m/i/miyamoto-HEAD/miyamoto/dispatcher.py   miyamoto(Download)
                self.socket = gevent.socket.create_connection((self.interface, 6002), source_address=(self.interface, 0))
 
                for line in util.line_protocol(self.socket):
                    event, payload = line.split(':', 1)
                    self.callback(event, payload)
    def _connection_handler(self, socket, address):
        print "pair connected"
        self.scheduler = socket
        for line in util.line_protocol(socket):
            self.queue.put(line)