hi there, folks:
I'd really like to release 0.7.0 but I would like it to be at least a
little bit tested before I do so. Could those of you with CVS trees check
everything out and see if it performs as advertised? Deeper bugs than
that will have to wait for the next release, but I'd at least like to know
if it works for someone other than me.
______ __ __ _____ _ _
| ____ | \_/ |_____] |_____|
|_____| |_____ | | | |
@ t w i s t e d m a t r i x . c o m
On 18 May 2004, the following message was posted to this mailinglist:
Jp Calderone exarkun at divmod.com wrote:
>Daniel Newton wrote:
> I have a simple XML-PRC server similar to the example below:
> from twisted.web import xmlrpc, server
> class Example(xmlrpc.XMLRPC):
> """An example object to be published."""
> def xmlrpc_add(self, a, b):
> """Return sum of arguments."""
> return a + b
> if __name__ == '__main__':
> from twisted.internet import reactor
> r = Example()
> reactor.listenTCP(7080, server.Site(r))
> I want to be able to get the address of the client that calls the
> method can anyone help me with this?
This solution didn't work because 'transport' isn't a property of the
I'm currently in the process of changing from a customized
SimpleXMLRPCServer to a twisted XMLRPC server solution and I need to
insert the client IP into the attributes passed to the called xmlrpc
method. Anyone who knows the answer and is willing to share the info?
After one year, I'm coming back to continue a project featuring Twisted Web, only to find "twisted.internet.app is deprecated, try twisted.application or the reactor instead".
Needless to say, after an hour's fooling around in the doc (which is just as chaotic and frustrating as a year ago), I haven't found the "new way to doing things".
The code I need to "convert":
if __name__ == '__main__':
from twisted.internet import app
# some other init code, unrelated to the problem
application = app.Application('tour')
application.persistStyle = 'aot'
Of course I know I must be the guy number 1,000,000 to ask this question, but the fact I can't find an answer to it (net even with Google) just worsen the situation.
Suggestion to doc writers: If you change your "stancard way to doing things", please included a "code convertion guide" of some kind into your tutorial.
Find what you are looking for with the Lycos Yellow Pages
My program first connects to another server and get some data to
initialises itself. When the initialisation finishes which could take
few minutes, it then start listening on a port and waiting to server
other clients. My question is, how do I delay the starting of my server
until the program is ready? I am currently using some thing like this in
my server.tac file, but this will star the server instantly.
client = internet.TCPClient(otherHost, otherPort, clientFactory)
server = internet.TCPServer(myPort, serverFactory)
I'm writing a console application with Twisted Matrix and I would like it
to work on both Unix and win32. Which reators and input/output-modules
should I use?
If I can only get the input to coexist with the Twisted reactor and some
basic output functions, that would be great. I will do the drawing myself
anyway, no need for a fully fledged drawing library like curses. Though,
that would work too if it has support for both Unix and Win32, which
Python curses doesn't have.
I am new to twisted, so I am still trying to grasp how to work with
twisted in the first place. Right now, what I am trying to do, is to
write some type of smtp proxy.
What I need is a program that will listen for SMTP connections, and will
intercept the SMTP commands, so that I can, for example:
- choose from a list of smtp servers to proxy to, based on the from and
to addresses (and maybe get this info from a database)
- send the mail I am currently receiving to the elected proxy or deny
the mail attempt entirely
- do some other types of checking
Can anyone please guide me on how I can write such a program?
PD: I have looked at some of the classes in twisted, but I just cannot
make out which one is best for this. At first I have tried to use the
portforward.Proxy class in order to write a simple proxy, but later on I
found this would not let me choose to which server I want to connect to,
but I was required to predefine the ip of the server.
Later on I looked directly at the smtp.SMTP class and somehow got to
manage a skeleton for my program, but I was stuck at not knowing how to
forward the mail I was already receiving to the elected server.
I also found the mail.MailService class, although I think this is a
little too much for my purposes (but I am not sure for what this class
is intended, since it also includes a pop3 and imap4 server, I think)
I am using twisted spread to pass large numbers between client and server.
Everything works ok, except when I try to pass the following number:
-2147483648. This causes to crash twisted, and the task administrator in
windows xp, shows the use of virtual memory increases to the maximum. No
exceptions nor error messages, simply frozes.
In the Banana specifications, -2147483648 is the limit of the negative
numbers allowed, but is included.
I am using twisted 1.3.0 and python 2.3 in a windows xp (both client and
>Note that we've had fine luck using the standard reactor and iterating
>it via a wxTimer, based off of the entry at:
>You do end up enforcing some time granularity on the network due to
>whatever timer frequency you pick, but so far it's been more than
>sufficient for our applications.
>The tweaks we made were to shorten the timer to about 150ms, and
>explicitly stop the timer and reactor in an OnExit() routine. I also
>experimented with additional reactor iterations in an Idle handler,
>but found that they really didn't make that much of a difference in
>Note that most of our wx-based applications are GUI interfaces, so the
>interface is the primary application with the networking in support of
>that. For those whose application is the opposite (the GUI is an
>add-on to the protocol support) it might be more limited by the impact
>of the periodic reactor execution, I'm not sure.
Thanks for the tip, I have tried such a method myself and it does seem to work with GUI focused apps. Unfortunately in my particular case the app has tight timing requirements due to multiple RTP instances each with a period of 30ms which wxTimer cannot meet.
I'm in the process of finishing a multicasting RTP streaming media server and client in Twisted but have encountered several issues that I can't figure out,
Firstly, Is there any way to determine your own IP address from with Twisted, I've looked around everywhere and can't find away to achieve this except by setting up a loopback connection and reading it from the transport - but that only gives 127.0.0.1. Is there any way to determine all available local IPs?
Also I have a problem in shutting down Factories - currently I shut them down by calling the doStop method, which seems to call stopFactory but this is an abstract method used just for safe user shutdown, right? As far as I can tell, the Factory is still bound to the reactor, and am I still able to connect to it having called doStop. How do I stop the protocol from even listening on ports?
Oh yeah, there seem to be a few bugs in the current wxreactor support, most notably with any custom dialog boxes - the OK/Cancel return doesn't seem to be processed on time and causes a wxDateTime assertion error, does it work for anyone else?
Thanks for any help