OTish: using short-term TCP connections to send to multiple slaves

Peter Otten __peter__ at web.de
Mon Nov 17 03:16:59 EST 2014


jkn wrote:

> Hi all
>     This is a little bit OT for this newsgroup, but I intend to use python
> for prototyping at least, and I know there are a lot of knowledgeable
> people using Python in a Network context here...
> 
> I have a use case of a single 'master' machine which will need to
> periodically 'push' data to a variety of 'slave' devices on a small local
> subnet, over Ethernet. We are talking perhaps a dozen devices in all with
> comms occurring perhaps once very few seconds, to much less often - once
> per half an hour, or less. There is probably an upper bound of 64KB or so
> of data that is likely to be sent on each occasion.
> 
> Previous similar systems have attempted to do this by maintaining multiple
> long-term TCP connections from the master to all the slave devices. The
> Master is the server and the slaves periodically check the master to see
> what has changed. Although this ... works ..., we have had trouble
> maintaining the connection, for reasons ... I am not yet fully aware of.
> 
> We are now considering an alternative approach where the master maintains
> a list of slave devices and acts as a client. Each device is a server from
> the point of view of data transfer. We would then use a short-lived TCP
> connection when data is available; the Master would connect to each slave
> which needed the data, send it, and close the connection.
> 
> I should also add that we desire our system to be 'robust' in the face of
> situations such as cable unplugging, device power cycles, etc.
> 
> Although this might get round some of our current problems, I can see that
> we might end up with new problems to deal with. I am wondering if this
> scenario rings bells with anyone, and seeking pointers to what has been
> done elsewhere. As I say, I am expecting to prototype it in Python so any
> specifics also welcome!
> 
> (suggestions as to a better forum to ask for previous experience also
> gratefully received)
> 
> Thanks al lot for any thoughts/suggestions

You said *any* suggestions, so:

I know nothing about them, but would a messaging infrastructure like 
RabbitMQ or ZeroMQ be useful?




More information about the Python-list mailing list