/[gli]/trunk/src/net/client/gliclient.py
Gentoo

Diff of /trunk/src/net/client/gliclient.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 937 Revision 938
26 raise GLIException("NetFeError", 'fatal', 'setup_network',"Was unable to find a network inferface.") 26 raise GLIException("NetFeError", 'fatal', 'setup_network',"Was unable to find a network inferface.")
27 return device[0], device[1] 27 return device[0], device[1]
28 28
29def find_server(): 29def find_server():
30 device = None 30 device = None
31 for device in GLIUtility.get_eth_devices(): 31 for dev in GLIUtility.get_eth_devices():
32 if device.startswith("eth"): 32 if dev.startswith("eth"):
33 device = GLIUtility.get_eth_info(num) 33 device = GLIUtility.get_eth_info(dev)
34 break 34 break
35 else: 35 else:
36 return False 36 return False
37 37
38 s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) 38 s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
48 response, fromaddr = s.recvfrom(1024) 48 response, fromaddr = s.recvfrom(1024)
49 if response: 49 if response:
50 print "Server found at " + str(fromaddr[0]) + " port " + str(fromaddr[1]) 50 print "Server found at " + str(fromaddr[0]) + " port " + str(fromaddr[1])
51 break 51 break
52 count = count + 1 52 count = count + 1
53 return fromaddr[0], fromaddr[1] 53 return fromaddr[0], int(fromaddr[1]) + 1
54 54
55if __name__ == '__main__': 55if __name__ == '__main__':
56 args = {} 56 args = {}
57 i = 1 57 i = 1
58 while i < len(sys.argv): 58 while i < len(sys.argv):
73 local_mac, local_ip = find_macip() 73 local_mac, local_ip = find_macip()
74 if 'server_ip' in args and 'server_port' in args: 74 if 'server_ip' in args and 'server_port' in args:
75 server_ip, server_port = args['server_ip'], args['server_port'] 75 server_ip, server_port = args['server_ip'], args['server_port']
76 else: 76 else:
77 server_ip, server_port = find_server() 77 server_ip, server_port = find_server()
78 server = xmlrpclib.ServerProxy("http://" + server_ip + ":" + server_port + 1) 78 server = xmlrpclib.ServerProxy("http://" + server_ip + ":" + str(server_port))
79 registered = False 79 registered = False
80 try: 80 try:
81 registered = server.register_client(local_mac, local_ip) 81 registered = server.register_client(local_mac, local_ip)
82 except: 82 except:
83 pass 83 pass

Legend:
Removed from v.937  
changed lines
  Added in v.938

  ViewVC Help
Powered by ViewVC 1.1.20