[Twisted-Python] Multicast XMLRPC
Chaz.
eprparadocs at gmail.com
Thu Aug 24 10:23:02 MDT 2006
Jean-Paul Calderone wrote:
> On Thu, 24 Aug 2006 11:49:49 -0400, "Chaz." <eprparadocs at gmail.com> wrote:
>> I have a XMLPRC client that works well under TCP and I am now trying
>> to get it to work under Multicast conditions.
>>
>> Here is the "TCP" code I used:
>>
>> class StorageService(internet.TCPServer):
>> def __init__(self,tcpPort,configInfo):
>> r = StoragePeer(configInfo)
>> xmlrpc.addIntrospection(r)
>> internet.TCPServer.__init__(self,tcpPort,server.Site(r))
>>
>> I changed the call to TCPServer to:
>>
>>
>> class StorageService(internet.TCPServer):
>> def __init__(self,tcpPort,configInfo):
>> r = StoragePeer(configInfo)
>> xmlrpc.addIntrospection(r)
>> internet.MulticastServer.__init__(self,tcpPort,server.Site(r))
>>
>> I thought this would work since, but it doesn't. What I get returned
>> is the following error message:
>>
>>
>> Failed to load application: unbound method __init__() must be called
>> with MulticastServer instance as first argument (got StorageService
>> instance instead)
>>
>>
>> Does anyone know what I am doing wrong?
>
> The immediate mistake you are making is trying to call an unbound method
> from one class with a self argument which is an instance of an unrelated
> class. This is not allowed in Python.
>
> The overall mistake you are making is trying to use XML-RPC over multicast.
> This does not work. Perhaps something like XML-RPC could be made to run
> over multicast, but it would be a much larger undertaking than just using
> MulticastServer in place of TCPServer.
>
> Jean-Paul
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
What I found when I did the following call:
internet.TCPServer(tcpport,server.Site(r))
that the call failed. Here is the trace output...perhaps someone can
tell me what is wrong...
Aug 24 12:22:26 sideshow whirlwind: [-] Traceback (most recent call last):
Aug 24 12:22:26 sideshow whirlwind: [-] File "TwistedPeer.py", line
146, in ?
Aug 24 12:22:26 sideshow whirlwind: [-] td.runApp(tdoptions)
Aug 24 12:22:26 sideshow whirlwind: [-] File
"/usr/lib64/python2.4/site-packages/twisted/scripts/twistd.py", line
196, in runApp
Aug 24 12:22:26 sideshow whirlwind: [-] startApplication(config,
application)
Aug 24 12:22:26 sideshow whirlwind: [-] File
"/usr/lib64/python2.4/site-packages/twisted/scripts/twistd.py", line
173, in startApplication
Aug 24 12:22:26 sideshow whirlwind: [-]
service.IService(application).privilegedStartService()
Aug 24 12:22:26 sideshow whirlwind: [-] File
"/usr/lib64/python2.4/site-packages/twisted/application/service.py",
line 191, in privilegedStartService
Aug 24 12:22:26 sideshow whirlwind: [-] service.privilegedStartService()
Aug 24 12:22:26 sideshow whirlwind: [-] File
"/usr/lib64/python2.4/site-packages/twisted/application/service.py",
line 191, in privilegedStartService
Aug 24 12:22:26 sideshow whirlwind: [-] service.privilegedStartService()
Aug 24 12:22:26 sideshow whirlwind: [-] File
"/usr/lib64/python2.4/site-packages/twisted/application/internet.py",
line 68, in privilegedStartService
Aug 24 12:22:26 sideshow whirlwind: [-] self._port = self._getPort()
Aug 24 12:22:26 sideshow whirlwind: [-] File
"/usr/lib64/python2.4/site-packages/twisted/application/internet.py",
line 86, in _getPort
Aug 24 12:22:26 sideshow whirlwind: [-] return getattr(reactor,
'listen'+self.method)(*self.args, **self.kwargs)
Aug 24 12:22:26 sideshow whirlwind: [-] AttributeError: StorageService
instance has no attribute 'args'
When I used the code I did, everything worked...
Chaz.
More information about the Twisted-Python
mailing list