def nsc_findNS(self, ident=None):
"""
Locating the Name Server by using given nsHost and nsPort
"""
locator = NameServerLocator(identification=ident)
try:
if self.nsHost:
self._log('connecting to Name Server (%s:%s)' % (self.nsHost,
self.nsPort))
self.NS = locator.getNS(self.nsHost, self.nsPort, trace=1, bcaddr=self.bcAddr)
else:
self._log('broadcasting to find Name Server')
self.NS = locator.getNS(None, None, trace = 1, bcaddr=self.bcAddr)
self.nsHost = self.NS.URI.address
self.nsPort = self.NS.URI.port
self.NS._setIdentification(ident)
self._log('Name Server found, URI = %s' % self.NS.URI)
self._setNSData()
except ConnectionDeniedError, e:
if str(e).find( Pyro.constants.deniedReasons[Pyro.constants.DENIED_SECURITY] ) != -1:
msg = 'Authentication required:'
dlg = wx.TextEntryDialog(self, msg, 'Authentication',
style=wx.OK|wx.CANCEL|wx.TE_PASSWORD)
dlg.CentreOnParent()
if dlg.ShowModal() == wx.ID_OK:
ident = dlg.GetValue()
self.nsc_findNS(ident)
else:
self.NS = None
self._log('Connection to Name Server denied!','error')
else:
self.NS = None
self._logError('Unable to connect to Name Server')
except:
self.NS = None
self._logError('Name Server not found!')
评论列表
文章目录