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?
Does anyone have some example code for building a reconnecting PB client?
This is what I have now:
from twisted.spread import pb
from twisted.internet import reactor
from twisted.python import util
events = pb.PBClientFactory()
reactor.connectTCP("localhost", 8789, events)
queue = events.getRootObject()
I'm new to Twisted. Perusing the documentation, I came across
IOCPReactor. It's marked as 'extremely experimental', and it appears it
only provides support for TCP events.
It seems the last check in to anything IOCPReactor-related was back in
2005. Is it dead? Is anyone using it? Is anyone planning to pick
development back up? Were there specific issues with IOCP that impeded
development, or just a general lack of people with time, inclination, or
Assuming the IOCPReactor's not feasible for high load production
deployment, can anyone comment on how the default select()-based reactor
for Win32 fares under high load?
I am interested in writing an MRCP (Media Resource Control Protocol )
server. In particular I want to write an MRCP speech recognition
resource server as part of my trefnydd  project. I am posting here
to ask for advice about the network programming part.
I shall also be writing an MRCP client (if only to test the server).
All the code will be GPL'd.
As far as I understand it, an overview of the networking would go like
An MRCP session between client and server is initiated using the Session
Initiation Protocol (SIP). Client and server negotiate using SIP
messages containing SDP message bodies to define the participants and
the resources required in the session. After session initiation, two
channels are launched: a media channel using RTP to carry binary audio
(i.e., speech) data, and a control channel using TCP (control channel
messages are text-based and in MRCP format).
It seems to me that both client and server software would have to cope
with SIP, SDP, RTP, MRCP (message format) and plain old TCP (for the
SIP/SDP and MRCP control channel messages).
Here are my questions:
- Does anyone know of a FOSS project to write an MRCP server? preferably
in python. I know of mrcp4j .
- My first plan would be to make the MRCP client/server a subclass of an
SIP client/server, as SIP is used to set up (and tear down) the session.
Does that sound sensible?
- Can twisted.protocols.sip be used to write a SIP server? Would it
give me everything I need, or would I also need something like pjsip 
or jain-sip  for the low-level stuff?
- Have I missed anything?
Any advice would be gratefully received. I'll report back with progress.
 MRCP: http://www.llaisdy.com/static/tech/mrcp/
 trefnydd: http://www.llaisdy.com/static/trefnydd/
 mrcp4j: "MRCP4J provides a Java API that encapsulates the MRCPv2
protocol and can be used to implement MRCPv2 clients and/or servers."
 pjsip: http://www.pjsip.org/
 jain-sip: https://jain-sip.dev.java.net/
I have an application which connects to a machine which has 50-60 ports open on it to receive data (each for a different region). It acts like a switch. Problem is that when I make all those connection requests at the same time the server falls over trying to handle all the connections requests from my application. I cannot control or change the behaviour of the server I am connecting to, however, I am also unable to find a way to easily to add a delay between connection requests in twisted (without blocking the reactor), so that only 2 or 3 start up at a time.
Is there an elegant and clean way to do such a thing? Twisted has worked beautifully for everything else, but I can't replace this one server for a while until I can duplicate the rest of its functionality, so I am dependant on it providing the data.
following Eli Criffields nice example  I implemented a small SSL
server with Twisted. My server should not only verify the client
certificate, but also check the Common Name (CN) against a whitelist.
All this should happen before any user data is exchanged.
Verifying the client certificate worked nicely, but I couldn't access
its contents: transport.getPeerCertificate() always returned 'None'.
Apparently Eli had the same problem .
After some testing with PyOpenSSL now I think I have found a solution:
Before we can get the client certificate, we have to make sure that the
SSL handshake has taken place. (If it hasn't, there simply is no client
certificate to deal with yet.) This can be done by calling the
do_handshake() method of the underlying socket. The SSL handshake takes
some time so we will have to try several times.
Here's an (incomplete) example showing the interesting part:
- - cut ---
# Make sure that SSL handshake has taken place
clientCert = self.transport.getPeerCertificate()
if clientCert is None:
log.msg("No client cert available.")
subject = clientCert.get_subject()
log.msg("Subject: %s" % subject)
log.msg("Common Name: %s" % subject.CN)
- - cut ---
If you see a nicer way to wait for the SSL handshake please let me
know. Using time.sleep() didn't work for me.
Getting the certificate in a dataReceived() instead of connectionMade()
works without manually doing the handshake. I think this is because the
underlying PyOpenSSL recv() method handles the handshake for us. But at
least for my purpose it makes more sense to verify the client cert
right upon connection, before any user data is exchanged.
I have run into an interesting little bug and before I try to hunt it
down further I wanted to check and see if anyone else has seen
I have a fairly complex twisted 2.5 application that uses
deferToThread to spawn off worker threads that need to call some
blocking non-twisted code (query webserver, query database, etc). The
application uses these workers quite a bit but there are normally
never more then 2 or 3 outstanding requests running.
The application runs rock-solid on Linux, but it crashes in less then
a minute on Windows.
Has anyone else seen anything like this? Are there any known issues
of deferToThread being less stable on Windows then Linux or are their
any differences between how twisted works on the platforms that I
should be looking into?
We need to match IP ranges of connections, were ranges are specified in the
"/" notation (e.g. 10.10.2.0/24)
What is the best way to do this without consuming too much CPU resources
when the connection rate is very high?