Basic Example Question
TCG TCGUtility <[email protected]>
| Newsgroups | gmane.comp.python.pyro |
|---|---|
| Message-ID | <CAAwYUBse1LogWuhzs3tKYcYCpnQtX3AoMfXY=1=8wKOpSEouLg@mail.gmail.com> |
I think I have a network issue but I just want to be sure I'm doing
completely the right thing.
I've got two machines: one is my laptop and the other a virtual machine
within my laptop.
It's possible to connect from laptop to vm on port 8000 for HTTP and PyRPC.
It's difficult/impossible to make connections back the other way (for
instance a web-server running on 80 or 8000 on the laptop will not be
visible to the VM).
OK so now to what I've tried.
On the Ubuntu VM I've got :
# saved as greeting.pyimport Pyro4
class GreetingMaker(object):
def get_fortune(self, name):
return "Hello, {0}. Here is your fortune message:\n" \
"Behold the warranty -- the bold print giveth and the
fine print taketh away.".format(name)
greeting_maker=GreetingMaker()
daemon=Pyro4.Daemon() # make a Pyro
daemonuri=daemon.register(greeting_maker) # register the greeting
object as a Pyro object
print "Ready. Object uri =", uri # print the uri so we can use it
in the client laterdaemon.requestLoop() # start the
event loop of the server to wait for calls
On the Windows laptop I've got :
# saved as client.pyimport Pyro4
uri=raw_input("What is the Pyro uri of the greeting object?
").strip()name=raw_input("What is your name? ").strip()
greeting_maker=Pyro4.Proxy(uri) # get a Pyro proxy to the
greeting objectprint greeting_maker.get_fortune(name) # call method
normally
On the ubuntu VM I start greeting.py and this is what I see :
(venv)tcgut@ubserver1:~/dev/bibimgjobcontserver$ python greeting.py
/home/tcgut/dev/bibimgjobcontserver/venv/local/lib/python2.7/site-packages/Pyro4/core.py:155:
UserWarning: HMAC_KEY not set, protocol data may not be secure
warnings.warn("HMAC_KEY not set, protocol data may not be secure")
Ready. Object uri = PYRO:obj_4ea116b397b94177abfe8e54d4cf8491@localhost:42049
Then on the windows laptop I start client.py and this is what I see :
(venv) C:\usr\tcgut\data\src\Python\bibimgjobcontrol>python client-greeting.py
What is the Pyro uri of the greeting object?
PYRO:obj_4ea116b397b94177abfe8e54d4cf8491@localhost:42049
What is your name? glaucon
C:\usr\tcgut\data\src\Python\bibimgjobcontrol\venv\lib\site-packages\Pyro4\core.py:155:
UserWarning: HMAC_KEY not set, protocol data may not be secure
warnings.warn("HMAC_KEY not set, protocol data may not be secure")
Traceback (most recent call last):
File "client-greeting.py", line 8, in <module>
print greeting_maker.get_fortune(name) # call method normally
File "C:\usr\tcgut\data\src\Python\bibimgjobcontrol\venv\lib\site-packages\Pyro4\core.py",
line 149, in __call__
return self.__send(self.__name, args, kwargs)
File "C:\usr\tcgut\data\src\Python\bibimgjobcontrol\venv\lib\site-packages\Pyro4\core.py",
line 266, in _pyroInvoke
self.__pyroCreateConnection()
File "C:\usr\tcgut\data\src\Python\bibimgjobcontrol\venv\lib\site-packages\Pyro4\core.py",
line 339, in __pyroCreateConnection
raise errors.CommunicationError(err)
Pyro4.errors.CommunicationError: cannot connect: [Errno 10061] No
connection could be made because the target machine actively refused
it
which on the surface looks like the Ubuntu VM is running a firewall
which is rejecting access on port 42049 - except
as far as I can tell it isn't running any firewall at all and (as
mentioned above) it's possible for HTTP traffic originating on
windows machine to get to a webserver on the Ubuntu VM
What I found really odd about this was providing a uri for the
server.py which said 'localhost' in the middle of it (when
I was trying to access a machine which was not localhost) so I tried
again only this time I adapted the uri used like this :
PYRO:obj_4ea116b397b94177abfe8e54d4cf8491-Q0ErXNX1RuaBWbWMMV2pGw@public.gmane.org:42049
so that it had the ip address of the VM instead of localhost and I got
the same response ('target machine actively refused it').
So my question is ... can someone confirm that what I'm doing here
should work ! I'm assuming it's some arcane
aspect of the network setup between the windows machine and the VM
that it's hosting but I'd like to be sure.
Also is there any way I can force all traffic onto port 80 or 8000 as
I know it's possible for the two machines to
communicate on those ports.
Thanks
R.
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Pyro-core mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyro-core