本文整理汇总了Python中Network.get_local_ip_address方法的典型用法代码示例。如果您正苦于以下问题:Python Network.get_local_ip_address方法的具体用法?Python Network.get_local_ip_address怎么用?Python Network.get_local_ip_address使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Network
的用法示例。
在下文中一共展示了Network.get_local_ip_address方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Connect
# 需要导入模块: import Network [as 别名]
# 或者: from Network import get_local_ip_address [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