title: Creating a socket restricted to localhost connections only
body: <p>I have a python program with many threads. I was thinking of creating a socket, bind it to localhost, and have the threads read/write to this central location. However I do not want this socket open to the rest of the network, just connections from <code>127.0.0.1</code> should be accepted. How would I do this (in Python)? And is this a suitable design? Or is there something a little more elegant?</p>