Here is what I have done so far... I have a dequeued collection that can be accessed by all the relevant classes. On the one end the HTTP Server appends items to this queue when it receives a valid HTTP request. On the other end, the SSMI client pops these items from the queue on a 5 seconds "callLater" based deferred and sends it out over the existing TCP connection.
Now this works, but I'm wondering if there is not a better way. Kind Regards, Don Schoeman Don Schoeman wrote: > Hi guys, > > I am busy developing a gateway of some sort and have the following > running so far on the reactor: > - HTTP Server listening for incoming connections and HTTP requests. > - LineReceiver client permanently connected to another server. > (Connection is established at startup) > > What I need to do is to first translate and then pass messages received > at the HTTP listening end - over to the LineReceiver client. The client > in turn will pass it on to a server using a custom protocol called SSMI, > for example: > > Web Browser Requests -> HTTPServer -> SSMIClient -> ServerXYZ > > For the HTTPServer I'm using the classic design where you inherit from > twisted.web.http.Request for the Protocol, while having > twisted.web.http.HTTPChannel and twisted.web.http.HTTPFactory inherited > classes to support it. > > Also, there will only ever be one SSMIClient protocol instance whereas > the HTTPServer needs to process multiple requests at a time, so it will > be a many-to-one design. > > What I need to know is how to pass the "packets" received by the > HTTPServer onto the SSMIClient protocol..? I am assuming one would use > deferreds, but the twisted.web.http.Request derived class seemingly does > not have "access" to the Reactor or it's Factory object. But to be > honest, I'm a little in over my head on this and don't even know how to > approach this. I don't know whether I should use a FIFO queue to store > the messages and I don't even know where to keep such a queue. If anyone > have done something even remotely like this I'd love to get some input > from you. It will be greatly appreciated! > > Kind Regards, > Don Schoeman > > _______________________________________________ > Twisted-Python mailing list > [email protected] > http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python > _______________________________________________ Twisted-Python mailing list [email protected] http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
