def __init__(self, url, dirname, urlfile):
     super(Client, self).__init__()
     self.secret = randomString(SECRET_LENGTH)
     n = Node(url, dirname, self.secret)
     t = Thread(target=n._start)
     t.setDaemon(1)
     t.start()
     sleep(HEAD_START)
     self.server = ServerProxy(url)
     for line in open(urlfile):
         line = line.strip()
         self.server.hello(line)
 def __init__(self, url, dirname, urlfile):
     super(Client, self).__init__()
     self.secret = randomString(SECRET_LENGTH)
     n = Node(url, dirname, self.secret)
     t = Thread(target=n._start)
     t.setDaemon(1)
     t.start()
     sleep(HEAD_START)
     self.server = ServerProxy(url)
     for line in open(urlfile):
         line = line.strip()
         self.server.hello(line)
Exemplo n.º 3
0
	def __init__(self, url, dirname, urlfile):
		self.password = randomString(PASSWORD_LENGTH)
		n = ListableNode(url, dirname, self.password)
		t = Thread(target=n._start)
		t.setDaemon(1)
		t.start()
		sleep(HEAD_START)
		self.server = ServerProxy(url)
		for line in open(urlfile):
			line = line.strip()
			self.server.hello(line)
		#Run GUI
		super(Client, self).__init__()
Exemplo n.º 4
0
 def __init__(self, url, dirname, urlfile):
     #创建一个随机密码,使用这个密码实例化ListableNode,利用它的start方法(确保Thread是个无交互的后台程序,这样它会随着程序退出而退出)启动一个Thread,读取URL文件中的所有URL,并且将Node
     #介绍给这些URL,最后设置GUI
     self.secret = randomString(SECRET_LENGTH)
     n = ListableNode(url, dirname, self.secret)
     t = Thread(target=n._start)
     t.setDaemon(1)
     t.start()
     #先启动服务器
     sleep(HEAD_START)
     self.server = ServerProxy(url)
     for line in open(urlfile):
         line = line.strip()
         self.server.hello(line)
     #运行GUI
     super(Client,self).__init__()
 def __init__(self, url, dirname, urlfile):
     """
     创建一个随机的密码,使用这个密码实例化Node。利用node的_start方法(确保thread是个无交互
     的后台程序,这样它会随着程序退出而退出)启动thread,读取URL文件中的所有URL,并且将node介绍给这些URL
     """
     super(Client, self).__init__()
     self.secret = randomString(SECRET_LENGTH)
     n = Node(url, dirname, self.secret)
     t = Thread(target=n._start)
     t.setDaemon(1)
     t.start()
     # 先启动服务器:
     sleep(HEAD_START)
     self.server = ServerProxy(url)
     for line in open(urlfile):
         line = line.strip()
         self.server.hello(line)
 def __init__(self, url, dirname, urlfile):
     """
     创建一个随机的密码,使用这个密码实例化Node,
     利用Node的_start方法(确保Thread是个无交互的后台程序,这样它会随着程序的退出而退出)启动THread,
     读取URL文件中的所有URL,并且将Node介绍给这些URL。
     """
     super(Client, self).__init__()
     self.secret = randomString(SECRET_LENGTH)
     n = Node(url, dirname, self.secret)
     t = Thread(target=n._start)
     t.setDaemon(1)  # 设置为True,主线程退出后会杀死子线程
     t.start()
     # 先启动服务器
     sleep(HEAD_START)
     self.server = ServerProxy(url)
     for line in open(urlfile):
         line = line.strip()
         self.server.hello(line)
Exemplo n.º 7
0
 def __init__(self, url, dirname, urlfile):
     """
     创建一个随机密码,使用这个密码实例化Node。
     利用Node的_start方法启动Thread
     (确保Thread是个无交互的后台程序,随程序退出而退出)
     读取URL文件的所有URL,并将Node介绍给这些URL
     """
     super(Client, self).__init__()
     self.secret = randomString(SECRET_LENGTH)
     n = Node(url, dirname, self.secret)
     t = Thread(target=n._start)
     t.setDaemon(1)
     t.start()
     # server start first
     sleep(HEAD_START)
     self.server = ServerProxy(url)
     for line in open(urlfile):
         line = line.strip()
         self.server.hello(line)
Exemplo n.º 8
0
 def __init__(self, url, dirname, urlfile):
     """
     Creates a random secret, instantiates a Node with that secret,
     starts a Thread with the Node's _start method (making sure the
     Thread is a daemon so it will quit when the application quits),
     reads all the URLs from the URL file and introduces the Node to
     them.
     """
     super(Client, self).__init__()
     self.secret = randomString(SECRET_LENGTH)
     n = Node(url, dirname, self.secret)
     t = Thread(target=n._start)
     t.setDaemon(1)
     t.start()
     # Give the server a head start:
     sleep(HEAD_START)
     self.server = ServerProxy(url)
     for line in open(urlfile):
         line = line.strip()
         self.server.hello(line)
Exemplo n.º 9
0
 def __init__(self, url, dirname, urlfile):
     """
     Creates a random secret, instantiates a Node with that secret,
     starts a Thread with the Node's _start method (making sure the
     Thread is a daemon so it will quit when the application quits),
     reads all the URLs from the URL file and introduces the Node to
     them.
     """
     super(Client, self).__init__()
     self.secret = randomString(SECRET_LENGTH)
     n = Node(url, dirname, self.secret)
     t = Thread(target=n._start)
     t.setDaemon(1)
     t.start()
     # Give the server a head start:
     sleep(HEAD_START)
     self.server = ServerProxy(url)
     for line in open(urlfile):
         line = line.strip()
         self.server.hello(line)
Exemplo n.º 10
0
    def __init__(self, url, dirname, urlfile):
        """
        Creates a random secret, instantiates a ListableNode with that secret,
        starts a Thread with the ListableNode's _start method (making sure the
        Thread is a daemon so it will quit when the application quits),
         them. Finally, sets up the GUI.
        """

        # Give the server a head start:
        sleep(HEAD_START)
        self.server = ServerProxy(url)
        super(Client, self).__init__()
        self.secret = randomString(SECRET_LENGTH)
        n = ListableNode(url, dirname, self.secret)
        t = Thread(target=n._start)
        t.setDaemon(1)
        t.start()
        for line in open(urlfile):
            line = line.strip()
            self.server.hello(line)