Beispiel #1
0
        writer.close()


    async def client_download(self, reader, writer):
        db_file = self.main.db.read_db()
        init_file_length = (len(db_file)).to_bytes(10, byteorder='big')
        data = init_file_length
        data += db_file
        writer.write(data)
        data = await reader.read(100)
        response = pickle.loads(data)


if __name__ == "__main__":
    Config.get_config(False)
    Text.get_text(False)
    loop = asyncio.get_event_loop()
    s = Server(loop, None)
    s.running = True
    coro = asyncio.start_server(s.handle_client,
                                '0.0.0.0',
                                55555, loop=loop)
    server = loop.run_until_complete(coro)
    print('Serving on {}'.format(server.sockets[0].getsockname()))
    try:
        loop.run_forever()
    except KeyboardInterrupt:
        pass

    # Close the server
    server.close()
Beispiel #2
0
    def build(self):
        # self.icon = 'myicon.png'
        Text.get_text(True)

        self.main = Main(self)
        return self.main.container