Esempio n. 1
0
 def testGetIP(self):
     localip=SU.getIpAddress()
     localhost=socket.getfqdn(localip)
     self.assertEqual(localip,SU.getIpAddress(localhost))
     myip=SU.getMyIpAddress()
     self.assertTrue(len(myip)>4)
     myip=SU.getMyIpAddress(workaround127=True)
     self.assertTrue(len(myip)>4)
     self.assertFalse(myip.startswith("127."))
     self.assertEqual("127.0.0.1", SU.getMyIpAddress("127.0.0.1",workaround127=False))
     self.assertNotEqual("127.0.0.1", SU.getMyIpAddress("127.0.0.1",workaround127=True))
Esempio n. 2
0
from Pyro4.socketutil import getMyIpAddress


class Thingy(object):
    def multiply(self, a, b):
        return a * b

    def add(self, a, b):
        return a + b

    def divide(self, a, b):
        return a // b

    def error(self):
        return 1 // 0

    def delay(self, seconds):
        time.sleep(seconds)
        return seconds

    def printmessage(self, message):
        print(message)
        return 0


d = Pyro4.Daemon(host=getMyIpAddress(workaround127=True), port=0)
uri = d.register(Thingy(), "example.batched")
print("server object uri:", uri)
print("batched calls server running.")
d.requestLoop()