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

Marko Rauhamaa marko at pacujo.net
Sun Nov 16 13:44:39 CET 2014


jkn <jkn_gg at nicorp.f9.co.uk>:

> Although this ... works ..., we have had trouble maintaining the
> connection, for reasons ... I am not yet fully aware of.

I can see your TCP connections are choppy. Your posting is breaking up.

Seriously, though, there shouldn't be any reason for TCP connections
dropping on their own. You need to have a chat with your IT people.

> 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.

There are numerous ways to accomplish what you desire, and they can all
be made to work.

One simple idea is to use tunneling. IP-over-IP, GRE or OpenVPN
tunneling would not mind the underlying ethernet interfaces going down
occasionally. At worst, there's some IP fragmentation issues, but your
data rates are so low that you wouldn't feel a thing.

> As I say, I am expecting to prototype it in Python so any specifics
> also welcome!

If you set up tunneling, you don't have to change your original working
Python code, and you'd be safe against cable thieves and adventurous IT
administrators.

> (suggestions as to a better forum to ask for previous experience also 

Marko



More information about the Python-list mailing list