Read from a network socket

    • If the network service you need to test will return ASCII data, then you could use:

      • telnet remote_host remote_port

This will open a connection to remote_host on the specified port remote_port.

    • If you need to read from a network socket in a script, try out:

      • cat < /dev/tcp/remote_host/remote_port

This is a neat feature in the bash shell. (not if you're using Debian bash). This feature was a carry-over from a Korn shell feature the team at AT&T implemented. This will open a read-only socket to host remote_host on port remote_port. I've had to use the actual IP address in some cases, but if your DNS is up to date, you may be able to just use the hostname.