[Twisted-Python] UDP + TCP + Serial

Werner Thie wthie at thiengineering.ch
Fri Apr 20 16:29:25 EDT 2007

Might be that I have something useful for you - please see the attached 
zipped code. Basic idea was to have a serially connected device 
accepting commands and delivering status information connected to a 
browser via a server delivering LiveFragments.

A few problems remain open, like:
   - how does one uniquely connect only one browser capable of sendign 
commands (the SPS is a single resource)

   - are other browsers able to connect and do a status display only

Forgive me if I did did not use twisted/nevow/athenain in all aspects 
correctly, but with lots of source/doc re- and rereading I was able to 
bring it that far. If there are patterns I should avoid or correct I 
will gladly do so if pointed out to me.

Thanks, Werner

Roel Schroeven wrote:
> I'm looking for a way to combine serial input with UDP (and possibly 
> TCP) communication.
> Currently I have a very simple quick-and-dirty script using pyserial and 
> the socket module without Twisted that reads line-based data from a 
> serial port and sends it out using UDP. It works very well, but 
> functional and reliability requirements are growing and I'm looking for 
> a better design. New functionality that we'll need is connection to a 
> database, two-way network communication to control the program while 
> it's running, and perhaps the ability to use encrypted connections for 
> the output data.
> Twisted seems nice, but apart from a few simple hello-world-style test I 
> don't have any experience with it. It doesn't seem too difficult though, 
> except for one thing: I can't find any concrete information on how to 
> combine serial communication and network communication. What reactor do 
> I need? How do I initialize it? How can I make it listen to both a 
> serial port and one or more UDP and/or TCP ports? I need to do this on 
> Linux, but it would be nice to have it working on Windows too.
> Many thanks,
> Roel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sps.zip
Type: application/x-zip-compressed
Size: 4272 bytes
Desc: not available
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20070420/713b5897/attachment.bin 

More information about the Twisted-Python mailing list