Clearly the code you posted is more economic and I suspect it will grow as more error handling is added. For example it looks like it opens a socket and keeps writing to it until the socket closes and that's not the behavior I'm looking for. Rather I want my worker thread to manage open/closing the socket while the mainline does the I/O to it. If multiple sockets are opened, the mainline will write the same strings to all of them, dealing with each connections independently closing/reconnecting. The main line should not care how many (if any) connections are active.
in reply to Re^5: Sharing sockets between the main script and thread
in thread Sharing sockets between the main script and thread
That's probably not all that obvious from looking at the code itself.