Esempio n. 1
0
 def startProtocol(self):
     self.myip = [
         ip for ip in gethostbyname_ex(gethostname())[2]
         if not ip.startswith("127.")
     ][0]
     self.transport.joinGroup(self.channel_group)
     #self.greeting('hello_maekin')
     self.transport.write('hello_maekin',
                          (self.channel_group, self.channel_port))
     chkAlive = task.LoopingCall(isAlive)
     task.start(random.randrange(1, 100, 1) / float(50))
Esempio n. 2
0
    #parser.add_option("-q", "--quiet",
    #                  action="store_false", dest="verbose", default=True,
    #                  help="don't print status messages to stdout")

    (options, args) = parser.parse_args()

    if options.identity != None:
        Identity.set_identity(options.identity)


    logging.basicConfig(format="%(asctime)s %(message)s", datefmt="%Y-%m-%d %H:%M:%S",
                        level=logging.INFO)


    logging.info("Sending dummy table on port %d", constants.ZMQ_RPC_PORT)

    zmq_factory = ZmqFactory()

    # Create a zeromq requestor object.

    zmq_requestor = zmq_requestor.ZmqRequestor(options.hostname, constants.ZMQ_RPC_PORT, zmq_factory)

    # Send the table at fixed intervals

    task = task.LoopingCall(send_dummy_table, zmq_requestor, options.schema_version)
    task.start(10.0)

    # Run the event loop

    reactor.run()
Esempio n. 3
0
   if not self.is_passive:
     try:
       self.listen(reactor)
     except error.CannotListenError, e:
       print e
       return 1
   
   if self.service_loaded:
     try:
       self.service.listen(reactor);
     except error.CannotListenError, e:
       print e
       return 1
   
   for task in self.tasks:
     task.start(10)
   
   return reactor.run()
 
 def addPeers(self, peers):
   for peer in peers:
     self.addPeer(peer)
 
 def addPeer(self, peer):
   try:
     ip = utils.IP(peer, port=self.defaultport)
   except:
     return False
   
   #self.debug("adding:", repr(ip.__class__))
   #self.debug("    ip:", str(ip))
Esempio n. 4
0
    #                  help="don't print status messages to stdout")

    (options, args) = parser.parse_args()

    if options.identity != None:
        Identity.set_identity(options.identity)

    logging.basicConfig(format="%(asctime)s %(message)s",
                        datefmt="%Y-%m-%d %H:%M:%S",
                        level=logging.INFO)

    logging.info("Sending dummy table on port %d", constants.ZMQ_RPC_PORT)

    zmq_factory = ZmqFactory()

    # Create a zeromq requestor object.

    zmq_requestor = zmq_requestor.ZmqRequestor(options.hostname,
                                               constants.ZMQ_RPC_PORT,
                                               zmq_factory)

    # Send the table at fixed intervals

    task = task.LoopingCall(send_dummy_table, zmq_requestor,
                            options.schema_version)
    task.start(10.0)

    # Run the event loop

    reactor.run()