title: How to use netcat as compressing proxy
body: <p>I have a server that receives messages in a text-based protocol. The server doesn't send back anything. These messages eat up network bandwidth a lot since the protocol is not binary and doesn't have any compression. To fix this I want to run a compressing proxy on the client and on the server side. On the client side, the proxy should receive the data over TCP, compress it, and send to the server-side proxy. The server-side proxy should receive data, decompress it, and send to the server application.</p>
  
  <p>The client-side code should be something like this:</p>
  
  <pre><code>cd /tmp
  mknod backpipe p
  nc localhost 7171 0&lt;backpipe | gzip | nc server-ip 7272 | tee backpipe
  </code></pre>
  
  <p>And on the server side:</p>
  
  <pre><code>cd /tmp
  mknod backpipe p
  nc -l -p 7272 0&lt;backpipe | gunzip | nc -l -p 7171 | tee backpipe
  </code></pre>
  
  <p>The server application works on 7171 port and the compressing proxy uses the 7272 port to transfer data. But this is not working for me for some reason.</p>