[Tutor] socket communications and threading

Alan Gauld alan.gauld at btinternet.com
Tue Oct 27 13:44:36 EDT 2015


On 27/10/15 14:52, richard kappler wrote:

> In our test environment we have simulated this by building three vm's. VM1
> has a python script that sends raw data over tcp to VM2 which parses the
> data and sends it over tcp to VM3 upon which we are developing our
> analytics apps.
>...

> 1. The data from the three different machines each gets it's own thread in
> production, so that would have to happen on 'VM2' as the 'VM1' are actually
> just microcontrollers out  in production. From a socket and threading
> perspective, which would be considered the client  and which the server,
> VM1 (the sender) or VM2 (the receiver)?

Client and server are about roles. The question is therefore
which machine is requesting a service and which is providing
it? Sounds like for the first transaction VM1 is asking VM2 to
store the data, so VM1 is client, VM2 is server.

However, for the analytics part, VM2 is asking for analysis and
VM3 doing the work so VM2 is client in that transaction and VM3
the server.

> 2. The process has worked mediocre at best thus far. When I developed the
> two python scripts (tunnelSim to send over socket and parser to rx and tx
> over socket) I started by just reading and writing to files so I could
> concentrate on the parsing bit. Once that was done and worked very well I
> added in sockets for data flow and commented out the read from and to files
> bits, and everything seemed to work fine, VM1 sent a number of 'lines', VM2
> received the same number of 'lines', parsed them and, seemed to send them
> on. Some days analytics (VM3) got them all, some days it did not. Not sure
> where to look, and any thoughts on troubleshooting this would be helpful,
> but the main point of the entire email is question 1, threading.

Where is the threading question in #1? I only saw a question about 
client/server - which has nothing at all to do with threading?

Slightly confused.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list