I want to create an echo server without specifying any of my commands inside strings. I want all commands to be connected by pipes.
This doesn't appear possible because the response gets returned before the request can be passed to the response generating logic. It seems I could use ncat but I also would prefer to avoid that.
I thought it might be possible with a fifo queue but I'm having trouble getting this to work.
The "What I'm trying to do" part
Attempting to justify these restrictions is challenging with my limited verbal skills. But my ultimate goal is to maintain a master script of all my application logic with the convenience of xinetd (but without daemons). Such a master script might have dozens of lines like these:
nc -l 8080 | get_person_name.sh | create_insert_statement.sh | sqlplus
nc -l 8081 | get_person_id.sh | create_select_statement.sh | sqlplus
The 2nd one won't work because it won't be able to return the output to the client. So I'm reducing the problem to implementing an echo server with netcat. I don't want to use strings because all those commands will be dynamic and I just don't want to deal with that extra level of indirection (for a start, my text editor will have far less useful syntax highlighting). I'd be open to a here document solution though.
httpcat.groovy
and it works excellently in my use cases so far).