本文整理汇总了Python中Network.getResidenceIp方法的典型用法代码示例。如果您正苦于以下问题:Python Network.getResidenceIp方法的具体用法?Python Network.getResidenceIp怎么用?Python Network.getResidenceIp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Network
的用法示例。
在下文中一共展示了Network.getResidenceIp方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getRooms
# 需要导入模块: import Network [as 别名]
# 或者: from Network import getResidenceIp [as 别名]
def getRooms(self):
if (self.ipResidence == None):
self.ipResidence = util.getResidenceIp()
if (self.ipResidence != "Residence is offline"):
tmp = util.httpGetRequest(self.ipResidence, 5432,"getRooms")
self.rooms = json.loads(tmp).keys()
else:
self.ipResidence = None
示例2: startThreadResidence
# 需要导入模块: import Network [as 别名]
# 或者: from Network import getResidenceIp [as 别名]
def startThreadResidence(self):
self.pbar.show()
self.residenceButton.set_sensitive(False)
self.pbar.set_text("Iniciando residência")
status = util.getResidenceIp()
self.pbar.hide()
self.clickedResidence = True
if (status == "Residence is offline"):
self.residenceButton.set_label("Residência iniciada")
os.system("python " + os.path.abspath("Residencia/server.py"))
else:
self.residenceButton.set_label("Residência iniciada na rede")
示例3: Connect
# 需要导入模块: import Network [as 别名]
# 或者: from Network import getResidenceIp [as 别名]
def Connect(self):
"""Método que faz a conexão com Residência
"""
myIp = util.get_local_ip_address("1.1.1.1")
print "mayyyyyyyyyyyyyyyyyyyyyyy0",util.get_local_ip_address("1.1.1.1")
while True:
port = self.room.getPort()
if(port != None):
print ("----------------------------My IP", myIp)
params = {"nameRoom": self.room.getName(), "ip": myIp, "port": port}
self.ipResidence = util.getResidenceIp()
if (self.ipResidence == "Residence is offline"):
print "Residence is offline"
os._exit(1)
print "sdssssssssssssss----------_",myIp,params,self.ipResidence
sucessToCreatComod = util.httpPostRequest(self.ipResidence, 5432, "addRoom", params)
if(sucessToCreatComod == False):
print "Problemas na conexao, tente novamente!"
os._exit(1)
elif (sucessToCreatComod == "Comodo já existe"):
print "Nome de room existente, altere-o"
os._exit(1)
break
self.connected = True