本文整理匯總了Python中GUI.setRemote方法的典型用法代碼示例。如果您正苦於以下問題:Python GUI.setRemote方法的具體用法?Python GUI.setRemote怎麽用?Python GUI.setRemote使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類GUI
的用法示例。
在下文中一共展示了GUI.setRemote方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: getUser
# 需要導入模塊: import GUI [as 別名]
# 或者: from GUI import setRemote [as 別名]
def getUser(username_local, server_name_local):
#連接服務器
try:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((server_name, remote_server_port))
sock.settimeout(15)
#檢測服務器是否關閉
except socket.timeout:
print "Error:timeout"
return None
sock.send('{"action":"login","uid":0,"username":"%s","ip":"%s"}' %(username_local,server_name_local))
userdata = sock.recv(1024)
print userdata
u = user.user()
u.set(json.loads(userdata))
while True:
print "[FLOATER FIND] try to find fellow"
sock.send('{"action":"find"}')
fellow = sock.recv(1024)
if fellow != "None":
print "[FLOATER FOUND]", fellow
userData = json.loads(fellow)
u.set(userData)
break
time.sleep(5)
sock.send('{"action":"close"}')
sock.close()
GUI.setRemote(u)