Пример #1
0
 def gen_new_client(self, prot, sock):
     u"""生成新的客户端对象."""
     current = time.time()
     cid, pos = self.generate_id()
     client = Client()
     client.mold = prot
     client.assign(sock)
     client.cid = cid
     client.active = current
     client.peername = sock.getpeername()
     client.register_server(self)
     self.count += 1
     self.clients[pos] = client
     self.queue.append(
         (config.NET_CONNECTION_ENTER, client, repr(client.peername)))
     self.sel.register(client.sock, selectors.EVENT_READ,
                       client.record_read)
Пример #2
0
 def __init__(self, app):
     self.app = app
     self.db = DB()
     self.search = False
     self.db.connect()
     self.db.create_tables()
     self.loop = asyncio.get_event_loop()
     self.container = Container()
     self.settings = Settings(self)
     self.loop = asyncio.get_running_loop()
     self.server = Server(self.loop, self)
     self.client = Client(self.loop, self)
     self.actionbar_widget_controller = ActionBarWidget(self)
     self.actionbar_dropdown_menu_controller = ActionBarDropDownMenu(
         self, self.actionbar_widget_controller)
     self.category = Category(self, self.db)
     self.note = Note(self, self.db)
     self.screen_controller = ScreenController(self)
     self.action_button_callback(Const.CATALOG_SCREEN)
Пример #3
0
 def clientLoop(self, opts):
     # client job
     from net.client import Client
     try:
         self.dir = os.getcwd()
         self.client = Client(opts.port)
         print "discovering server..."
         res = self.client.discover(opts.hostId, opts.hostName)
         print "Server discovered at:", self.client.server
         hostId = res['hostId']
         self.client.hostId = hostId
         task = res['task']
         print "Host id:", hostId
         print "Task:", task
         if not task:
             raise Exception("Task is None")
         args = task.split()
         klass = self.importClass(args[0])
         return klass().run(args[1:], self.clientCallback)
     except (Exception, KeyboardInterrupt) as e:
         reporter.Reporter().reportExc("FuzzerClient", e)
         raise
Пример #4
0
# ================
# Solex - solex.py
# ================

# Local.
from net.client import Client


if __name__ == "__main__":
    client = Client()
    client.run()

Пример #5
0
def start_client():
	u"""启动客户端."""
	client = Client()
	client.register()
	client.start("127.0.0.1", 23456)
	return client