Using ZEO for remote access
I want to use Zope as an application server and was thinking to connect to Zope from the clients, by using ZEO. This will give me remote access to the objects in a more powerfull way than using XML-RPC. I have tried the following code to get a connection to a running ZEO instance (the setup works, as a Zope Instance can connect to the ZEO server): from ZEO.ClientStorage import ClientStorage cs = ClientStorage([('localhost', 9999)]) The code blocks at the creation of the ClientStorage and never returns. Am I on the right path, or is there a better way to connect to a running ZEO instance from Python code? Thanks Etienne
Etienne Labuschagne wrote at 2005-2-18 21:15 +0200:
I want to use Zope as an application server and was thinking to connect to Zope from the clients, by using ZEO.
This sentencse looks wrong... You clients connect to ZEO bypassing Zope...
... I have tried the following code to get a connection to a running ZEO instance (the setup works, as a Zope Instance can connect to the ZEO server):
from ZEO.ClientStorage import ClientStorage cs = ClientStorage([('localhost', 9999)])
Drop the "[]", i.e. use cs = ClientStorage(('localhost', 9999)) Of course, ZEO should run on localhost, port 9999, for this to work. If it does not, the client hangs (waiting for ZEO to become available). -- Dieter
Dieter, On Sat, 19 Feb 2005 19:45:14 +0100, Dieter Maurer <dieter@handshake.de> wrote:
Etienne Labuschagne wrote at 2005-2-18 21:15 +0200:
I want to use Zope as an application server and was thinking to connect to Zope from the clients, by using ZEO.
This sentencse looks wrong...
You clients connect to ZEO bypassing Zope...
Thanks for pointing that out, I have mis-quoted myself. Yes, I will bypass Zope entirely and connect to the ZEO shared database from multiple clients.
... I have tried the following code to get a connection to a running ZEO instance (the setup works, as a Zope Instance can connect to the ZEO server):
from ZEO.ClientStorage import ClientStorage cs = ClientStorage([('localhost', 9999)])
Drop the "[]", i.e. use
That was how I tried it the first time. The [] I think I got out of some tool script that tests if ZEO is up - that script, by the way also hangs indefinately. So does the pack script. Adding or removing the [] makes no difference to the hanging.
cs = ClientStorage(('localhost', 9999))
Of course, ZEO should run on localhost, port 9999, for this to work. If it does not, the client hangs (waiting for ZEO to become available).
-- Dieter
I have tried all the permutations of clients on Windows and Linux connecting to a ZEO running on Windows and Linux, here are the results: Windows -> Linux ZEO : Hangs Windows -> Windows ZEO : Hangs Linux->Linux ZEO : Works Linux->Windows ZEO : Works. It seems my problem is with clients running on Windows. Funny thing is, the Zope instance I have on Windows can connect fine. So it should be do-able from Windows. Unfortunately, my client program will typically run on Windows machines. Etienne
Etienne Labuschagne wrote at 2005-2-19 21:03 +0200:
... ZEO client connecting to ZEO server ... I have tried all the permutations of clients on Windows and Linux connecting to a ZEO running on Windows and Linux, here are the results:
Windows -> Linux ZEO : Hangs Windows -> Windows ZEO : Hangs Linux->Linux ZEO : Works Linux->Windows ZEO : Works.
It seems my problem is with clients running on Windows. Funny thing is, the Zope instance I have on Windows can connect fine. So it should be do-able from Windows.
It is. Colleagues of mine connect from Windows ZEO clients to a Unix ZEO server. And your Zope (as you noticed), too, is a ZEO client. Are you sure that you use the correct host and port? -- Dieter
On Sun, 20 Feb 2005 19:05:31 +0100, Dieter Maurer <dieter@handshake.de> wrote:
Etienne Labuschagne wrote at 2005-2-19 21:03 +0200:
... ZEO client connecting to ZEO server ... I have tried all the permutations of clients on Windows and Linux connecting to a ZEO running on Windows and Linux, here are the results:
Windows -> Linux ZEO : Hangs Windows -> Windows ZEO : Hangs Linux->Linux ZEO : Works Linux->Windows ZEO : Works.
It seems my problem is with clients running on Windows. Funny thing is, the Zope instance I have on Windows can connect fine. So it should be do-able from Windows.
It is. Colleagues of mine connect from Windows ZEO clients to a Unix ZEO server.
And your Zope (as you noticed), too, is a ZEO client.
Are you sure that you use the correct host and port?
-- Dieter
I have solved my problem. I only get the lock-ups with the Python installed on my machine. Not when using the Python interpreter supplied with the Zope. After stepping through with the debugger, I realised that I have a ZEO and ZODB in my site-packages of my Python installation. The ZEO in my Python installation is 2.1.5c1. The ZEO supplied with my Zope is 2.2.1. I guess there is some incompatability with the two. What threw me off course, was that I put the correct ZEO on the sys.path and assumed that was the one that was used. In reality, an older one "earlier" in the path was used. Sorry for the trouble, I could have solved my own problem if I took the trouble of firing up the debugger earlier! Thanks Etienne
participants (2)
-
Dieter Maurer -
Etienne Labuschagne