Changeset 180

Show
Ignore:
Timestamp:
Sat Aug 26 23:46:02 2006
Author:
Brian
Message:

change server to publish service availability via zero config

Files:

Legend:

Unmodified
Added
Removed
Modified
  • server/trunk/update/server/ganttpv_update_server.py

    r171 r180  
    30 30 # 060401 - sessions work  
    31 31 # 060824 - changed name format of backup files  
      32 # 060826 - publish service availability via zero config  
    32 33  
    33 34 import SimpleXMLRPCServer  
     
    40 41 import time  
    41 42 import socket  # only for the error handling  
      43 import Zeroconf  
    42 44  
    43 45 debug = 3  
     
    821 823         f.close()  
    822 824  
      825 def Zero(server_ip, server_port):  
      826     global server  # save server  
      827     server = Zeroconf.Zeroconf()  
      828  
      829     # Get local IP address  
      830     # local_ip = socket.gethostbyname(socket.gethostname())  
      831     local_ip = socket.inet_aton(server_ip)  
      832  
      833     svc1 = Zeroconf.ServiceInfo('_ganttpv._tcp.local.',  
      834                               'GanttPV Server._ganttpv._tcp.local.',  
      835                               address = local_ip,  
      836                               port = server_port,  
      837                               weight = 0, priority=0,  
      838                               properties = {'description':  
      839                                             'GanttPV Server'}  
      840                              )  
      841     server.registerService(svc1)  
      842  
    823 843 def StartServer():  
    824 844     # change permissions of current and backup to allow only owner access  <-- TO DO !!!  
     
    839 859             tries = 0  
    840 860  
      861     Zero(server_ip, server_port)  
      862  
    841 863     # Test functions  
    842 864     # server.register_function(callxx)