title: Program fails to get a hold on to the output stream sometimes. Why is it so?
body: <p>I have two programs , which are sitting on either side of a network socket . I have them make conversation with each other. One of them is a chat bot, which gives some responses, depending on what i enter as an input in  the other program . Most of the time it does work flawlessly. But sometimes , the chat bot keeps waiting and waiting and i don't get any reply back from it. This , however , happens very rarely. But does any one know, why it is happening ?  How can i get rid of this obvious bug ?</p>
  
  <p>I do check for most of the exceptions here, i/o exceptions being the most predominant one. But i don't really get any exceptions. The program systems to hang around a thread , which i found out during debugging it .</p>