title: How can I close a netcat connection after a certain character is returned in the response?
body: <p>We have a very simple tcp messaging script that cats some text to a server port which returns and displays a response.</p>
  
  <p>The part of the script we care about looks something like this:</p>
  
  <pre><code>cat someFile | netcat somehost 1234
  </code></pre>
  
  <p>The response the server returns is 'complete' once we get a certain character code (specifically <code>&amp;001C</code>) returned.</p>
  
  <p><strong>How can I close the connection when I receive this special character?</strong></p>
  
  <p><em>(Note: The server <strong>won't</strong> close the connection for me. While I currently just CTRL+C the script when I can tell it's done, I wish to be able to send many of these messages, one after the other.)</em></p>
  
  <p><em>(Note: <code>netcat -w x</code> isn't good enough because I wish to push these messages through as fast as possible)</em></p>