I want to forward xinetd connection to another local port (say 12345). I based my solution on CentOS/Redhat documentation Chapter 17. [TCP Wrappers and xinetd, article 126.96.36.199]
. In the example the configuration starts a daemon and also redirects the traffic to a host: port. The doco say it should be able to forward to different port on the same system too.
My current goal is to starts a daemon (say testsmpp) at any connection on port 12345 and redirect the stream to a particular port (say 54321). The tricky bit is I don't want the daemon (testsmpp) to read from STDIN, instead it should be able to read from the port where the xinetd is forwarding the traffic to.
I created a service under /etc/service e.g
And my xinetd configuration for the daemon is
sock_type = stream
protocol = tcp
wait = no
user = root
server = /home/me/bin/testsmpp
redirect = 54321
testsmpp listens on port 54321. The problem is when a connection made from outside, xinetd starts the daemon but do not forward the traffic to 54321. Once the server started I can connect directly to 54321 port but the connection made via xinetd (at port 12345) is not forwarded.
Is server and redirect tags are mutually exclusive? I looked at the discussion about xinet forking concurrent server
but my motivation are slightly different. I want to listen for incoming connection on another port as the other application will communicate with the daemon on that port too in a distributed computing environment.
Any clues much appreciated.