def __init__(self, port, password, handler): try: self.handler = handler self.password = password # Call parent class constructor explicitly asyncore.dispatcher.__init__(self) # Create socket of requested type self.create_socket(socket.AF_INET, socket.SOCK_STREAM) # restart the asyncore loop, so it notices the new socket eg.RestartAsyncore() # Set it to re-use address # self.set_reuse_addr() # self.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) # Bind to all interfaces of this host at specified port self.bind(('', port)) # Start listening for incoming requests. The parameter is the maximum number of queued connections. self.listen(5) except: eg.PrintError("TCPEvents: Error in Server.__init__: " + str(sys.exc_info()))
def __init__(self, address, port, plugin): self.irCommand = [] self.remAddress=address self.plugin=plugin asyncore.dispatcher.__init__(self) self.create_socket(AF_INET, SOCK_DGRAM) eg.RestartAsyncore() self.bind(('', port))
def __start__(self, port, ip, prefix): global smtpdPrefix self.port = port self.ip = ip smtpdPrefix = prefix print 'Starting SMTPd Server at %s:%s' % (self.ip, self.port) self.server = CustomSMTPServer((self.ip, self.port), None) eg.RestartAsyncore()
def __init__(self, port, selfXbmceventbroadcast, payDelim, plugin): self.selfXbmceventbroadcast = selfXbmceventbroadcast self.plugin = plugin self.port = port self.payDelim = payDelim asyncore.dispatcher.__init__(self) self.ipadd = socket.gethostbyname(socket.gethostname()) self.create_socket(socket.AF_INET, socket.SOCK_DGRAM) eg.RestartAsyncore() self.bind(('', port))
def __init__ (self, port, handler): try: self.handler = handler asyncore.dispatcher.__init__(self) self.create_socket(socket.AF_INET, socket.SOCK_STREAM) eg.RestartAsyncore() self.bind(('', int(port))) self.listen(5) except: eg.PrintError("Error 3: Server Init: " + str(sys.exc_info()))
def __init__(self): self.AddAction(SetSwitchPower) self.AddAction(TogglePower) self.AddAction(SetDimming) self.AddAction(RunScene) self.HTTP_API = VERA_HTTP_API() #self.dispatcher = VeraAsyncDispatcher() self.vera = [] self.verbose = True eg.RestartAsyncore()
def __init__(self, handler): self.handler = handler asyncore.dispatcher.__init__(self) self.create_socket(socket.AF_INET, socket.SOCK_STREAM) eg.RestartAsyncore() self.bind(('', handler.localPort)) self.listen(5)
def __init__(self, address, port, plugin): self.lastNotId = None self.remAddress = address self.plugin = plugin key = self.plugin.password.Get() if key: for i in range(10): h = md5() h.update(key) key = h.digest() self.key = key dispatcher.__init__(self) self.create_socket(AF_INET, SOCK_DGRAM) eg.RestartAsyncore() self.bind(('', port))
def __init__(self, plugin, address): # Call constructor of the parent class asynchat.async_chat.__init__(self) # Set up input line terminator self.set_terminator('\r\n') # Initialize input data buffer self.data = '' self.plugin = plugin self.create_socket(socket.AF_INET, socket.SOCK_STREAM) eg.RestartAsyncore() try: self.connect(address) except: pass
def __init__(self, plugin, address): self.plugin = plugin # Call constructor of the parent class asynchat.async_chat.__init__(self) # Set up input line terminator self.set_terminator('') # create and connect a socket self.create_socket(socket.AF_INET, socket.SOCK_STREAM) eg.RestartAsyncore() self.settimeout(2.0) try: self.connect(address) except: pass
def __init__(self, port, handler): self.handler = handler # Call parent class constructor explicitly asyncore.dispatcher.__init__(self) # Create socket of requested type self.create_socket(socket.AF_INET, socket.SOCK_STREAM) # restart the asyncore loop, so it notices the new socket eg.RestartAsyncore() # Bind to all interfaces of this host at specified port self.bind(('', port)) # Start listening for incoming requests #self.listen (1024) self.listen(5)
def __init__(self, host, port, handler): log("_enter_tcp_client__init") self.host = host self.port = port self.handler = handler # Call parent class constructor explicitly asyncore.dispatcher.__init__(self) # Create socket of requested type self.create_socket(socket.AF_INET, socket.SOCK_STREAM) # restart the asyncore loop, so it notices the new socket eg.RestartAsyncore() self.connect((self.host, self.port)) log("_leave_tcp_client__init__")
def __init__(self, port, listenAddr, selfBroadcast, payDelim, plugin): self.selfBroadcast = selfBroadcast self.plugin = plugin self.addresses = socket.gethostbyname_ex(socket.gethostname())[2] self.addresses.sort(key=lambda a: [int(b) for b in a.split('.', 4)]) self.port = port self.payDelim = payDelim if listenAddr in self.addresses: self.listenAddr = listenAddr else: addrs = socket.gethostbyname_ex(socket.gethostname())[2] self.listenAddr = addrs[0] asyncore.dispatcher.__init__(self) self.create_socket(socket.AF_INET, socket.SOCK_DGRAM) eg.RestartAsyncore() self.set_reuse_addr() self.bind((self.listenAddr, self.port))
def __init__(self, port, password, handler): self.handler = handler self.cookie = hex(random.randrange(65536)) self.cookie = self.cookie[len(self.cookie) - 4:] self.hex_md5 = md5(self.cookie + ":" + password).hexdigest().upper() # Call parent class constructor explicitly asyncore.dispatcher.__init__(self) # Create socket of requested type self.create_socket(socket.AF_INET, socket.SOCK_STREAM) # restart the asyncore loop, so it notices the new socket eg.RestartAsyncore() # Set it to re-use address #self.set_reuse_addr() # Bind to all interfaces of this host at specified port self.bind(('', port)) # Start listening for incoming requests #self.listen (1024) self.listen(5)