def connect(self): if self.connected: return self.log(MythLog.SOCKET | MythLog.NETWORK, MythLog.INFO, "Connecting to backend [%s]:%d" % (self.host, self.port)) if ':' in self.host: self.socket = deadlinesocket(socket.AF_INET6, socket.SOCK_STREAM) else: self.socket = deadlinesocket(socket.AF_INET, socket.SOCK_STREAM) self.socket.log = self.log self.socket.connect((self.host, self.port)) self.socket.setdeadline(self.deadline) self.connected = True self.check_version() self.announce()
def connect(self): if self.connected: return self.log(MythLog.SOCKET|MythLog.NETWORK, MythLog.INFO, "Connecting to backend [%s]:%d" % (self.host, self.port)) if ':' in self.host: self.socket = deadlinesocket(socket.AF_INET6, socket.SOCK_STREAM) else: self.socket = deadlinesocket(socket.AF_INET, socket.SOCK_STREAM) self.socket.log = self.log self.socket.connect((self.host, self.port)) self.socket.setdeadline(self.deadline) self.connected = True self.check_version() self.announce()
def connect(self, test=True): if self.isConnected: return True self.socket = deadlinesocket(socket.AF_INET, socket.SOCK_STREAM) self.socket.setdeadline(self._deadline) self.socket.log = self.log try: self.socket.connect((self.host, self.port)) except: raise MythFEError(MythError.FE_CONNECTION, self.host, self.port) self.isConnected = True if test: self._test()