Oh, darn!! Forgot all about this when I started my project. I've read
thru most of the docs I've found so far, but I'm still somewhat
clueless. Can anybody provide a simple example of how to do this,
preferrably without using the examples in
http://twistedmatrix.com/documents/current/howto/using-twistedweb#auto19.
I'm hooking a xmlrpc-handler and a UDP listener into it as well and
find the good ol'
site = server.Site(MyResource())
reactor.listenTCP(8080, site)
reactor.run()
way of doing it better than mktap etc. Feel like I got more control
doing it the manual way.
Anyhow, thanks for your input so far. I just love Twisted !! :-)
Best regards,
Thomas
On 28 Sep 2004 15:25:15 -0400, David Bolen
Thomas Weholt
writes: A few users connect to the main server, requesting files on the subnet web-servers. The main server reads data from several subnet servers and writes the data back to the requesting clients. How can I do this in twisted, without blocking, and handle several clients? We're not talking hardcore P2P here with thousands of clients, most likely 2-5 concurrent users, 10 at the most.
I haven't had an opportunity to use it myself yet, but there is a twisted.web.spread module that may work since all of your servers are using Twisted.
On the subnet servers, wrap your site object in the ResourcePublisher object (a pb.Root subclass) and set that up to listen on an appropriate port.
On the main server, for each resource root that you want proxied out to a remote server, insert an appropriate child resource using ResourceSubscription.
A PB link used to transmit the requests between the two machines, which means that all of the server render() calls to be proxied are handled in a deferred fashion.
I expect there may be a way to interconnect your server into a client HTTP class to proxy to the subset servers using a more traditional web request, but given that you are Twisted throughout, probably no reason not to go ahead and use the PB approach.
It does look like these classes still use the older pb.getObjectAt approach for the connection rather than the newer getRootObject, but it should still work. If it doesn't directly suit what you want, it it may at least give you an idea for your own approach (since neither of those classes is overly complex).
-- David
_______________________________________________ Twisted-web mailing list Twisted-web@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
-- Mvh/Best regards, Thomas Weholt http://www.weholt.org