I'm trying to test if a service is up and running using nc.
echo ruok | nc 127.0.0.1 5111
But I get this response:
This is nc from the netcat-openbsd package. An alternative nc is available
in the netcat-traditional package.
usage: nc [-46DdhklnrStUuvzC] [-i interval] [-P proxy_username] [-p source_port]
[-s source_ip_address] [-T ToS] [-w timeout] [-X proxy_protocol]
[-x proxy_address[:port]] [hostname] [port[s]]
I'm not sure how to use this 'alternative nc', can someone please explain this to me?
I tried:
echo ruok | nc -s 127.0.0.1 -p 5111
but I got the same message.
echo ruok | nc 127.0.0.1 5111is in fact the right command format. Fortunately, nc is very easy to test. In one terminal, enter:nc -l 5111. This will start a process that listens on port 5111 for incoming packets. In another terminal window, enter the command above. You should see the string "ruok" appear in the first terminal. – Jos Jun 18 '14 at 14:21