title: How do I "share" a socket between a thread and a function?
body: <p>I'm trying to get user input from stdin whilst receiving data from a socket. Then I want to send the user input to the socket. How can I pass the socket to a thread that is able to send and read whilst having the main function reading from stdin and sending it to the socket. This function does not need to be able to read from the socket. 
  I would prefer being able to use a BufferedStream as my socket reader. <br>
  Thread receives and sends -(while)- function gets input from stdin and sends to socket.</p>