[Twisted-web] Having reactor run at the main thread make things
harder for late adopters
Tzury Bar Yochay
tzury.by at gmail.com
Tue Nov 4 16:03:16 EST 2008
On Tue, Nov 4, 2008 at 10:56 PM, George Pauly
<george at ringdevelopment.com> wrote:
> On Tue, 2008-11-04 at 22:20 +0200, Tzury Bar Yochay wrote:
>> I will first describe my application in a single sentence.
>> Write a server that can serve TCP/UDP clients on several ports, and
>> let the clients communicate with each other in a predefined protocol,
>> while each can 'talk' to the server in a different protocol/port.
> Are the clients communicating directly or through the server?
clients are to communicate via server only (they are behind NATs)
> Are the ports specific to either client/server communication or
> (presuming the answer to the first question) client/client
Clients can communicate with the server using either one of predefined
You never know what port/protocol the firewall will allow them
>> In my case where I picked up Twisted relatively late in the project I
>> need Twisted to plugged into my applocation and not the my application
>> plugged-into Twisted (at least at this stage).
> Is this because the client is already written with a specific protocol
> in mind?
That is correct!
>> Is there a way to by-pass this limitation?
>> At this stage the main problem I see is having transport.write will
>> have data transmitted immediately when called from another thread.
> You already have threads in your server? Is this the limitation? If
> so, are the threads there to handle client connections?
I am using (thread-safe) queue.Queue and have one for
incoming-requests and another one for pending-responses.
I have one thread which read on request at a time and handle it. once
done, puts a response in the response-queue. Bare in mind that the
response might be forwarded to another client or to the original
sender depend on the case.
If I won't find a decent way to hack this I might going to rewrite the
more code than I can allow myself at this point of time.
> George Pauly
> Ring Development
> Twisted-web mailing list
> Twisted-web at twistedmatrix.com
Tzury Bar Yochay
More information about the Twisted-web