I'd like to take a program P that reads from stdin & writes to stdout, but connect it to nc or whatever such that it reads from a certain port and outputs to another port.
# The reading is easy, here P reads from port 50505
nc -l 50505 | P
How do I get it to write back to say port 60606?