You can use netcat
or nc
as a debugging TCP tool. It can be a TCP sender and receiver with a short session (auto close when connection is closed)
Examples :
Scan ports
$ nc -zv 127.0.0.1 20-80
Check redis status
$ echo 'info' | nc 127.0.0.1 6379
Retrieve http response
$ printf "GET /xinchao HTTP/1.1\r\n\r\n" | nc 127.0.0.1 8000 | tee xinchao.txt
Change to IPv6 : nc -6
Want more ??
$ nc -h