[Twisted-Python] Selectable SerialPort Windows/Linux

exarkun at twistedmatrix.com exarkun at twistedmatrix.com
Tue Sep 14 08:28:17 MDT 2010


On 02:00 pm, mhubig at imko.de wrote:
>On Tue, Sep 14, 2010 at 3:46 PM, <exarkun at twistedmatrix.com> wrote:
>>I'm not sure I understand this.  What is a "Master-Slave" protocol? 
>>Why
>>would someone not benefit from a Twisted-based implementation of such 
>>a
>>protocol?
>
>
>OK I'm not sure either ;-) this is why I ask. But in my case I have the
>following
>situation: behind my serial port I have a bus system made of me (the 
>master)
>and some slaves. The slaves are absolute passive until I send them a
>command.
>After I've send a command to one of my slaves the salve ALWAY reply by
>sending
>a packet.
>
>So what's the benefit if I have a "deamon thread" waiting the hole time 
>to
>get
>something from the serial line if the only time it can get something is
>immediately
>after the master has send a packet? The communication
>is totally synchronous.

Do you ever want to interact with more than one slave?  Do your slaves 
ever have any bugs that prevent them from responding?  Do you want to be 
able to unit test your protocol code easily?  If  you want any of this, 
you might want to use Twisted.

Also, there generally aren't any threads involved when you're using 
Twisted's serial port support.

Jean-Paul




More information about the Twisted-Python mailing list