Thanks for your response!
How would I go about putting this into 2 commands? I am trying this first without using gzip. Please bear with me as I am not well versed on how piping works.
I believe the following command shows the points that gzip should occur;
Code:
while true ; do cat /tmp/fifo | nc -l -p 8008 | gzip | nc localhost 80 | gzip -d > /tmp/fifo ; done
I get the following error, which indicates you may be right
Code:
gzip: stdin: unexpected end of file
Code:
while true ; do nc -l 8080 (| gzip )| nc localhost 80 ; done
This would send from from client to the server, wouldn't it?
This is the part I get stuck at. How can I read back data only in one command? The following is an educated guess, however I can't use it because port 8080 is already in use.
Code:
while true ; do nc localhost 80 (| gzip -d )> /tmp/rev | nc -l 8080 ; done
How can I adjust this to make it work?
Another possible problem I was thinking of might be that gzip will not know when to stop compressing, then at the end send everything in one big gz file. Optimally, I would like only one packet compressed, then sent on. Will this happen, or is there something I can add to make sure that compression only occurs for x bytes (eg the MTU size). Of course, I don't think I am limited to using gzip, if there is another program which can act in this way, I will use it instead.
Thanks again for any help.
Edit: I now have 2 separate commands working although I am not sure where to go next. It seems as though reading and writing are still occurring in both commands so it might not be useful;
Code:
cat fifo2 | nc -l 8080 > fifo1
Code:
cat fifo1 | nc localhost 80 > fifo2
Can gzip be added to these commands, or do I need to make different changes? The following does not seem to work.
Code:
cat fifo2 | nc -l 8080 | gzip > fifo1
Code:
cat fifo1 | nc localhost 80 | gzip -d fifo2