The simplest and easiest method is given below.
sleep <n> | telnet <server> <port>
n - timeout in seconds before automatic exit. It can be fractional, like 0.5. Please note that some required output may not return at the specified timeout. Therefore, we may need to increase accordingly.
server — The IP address of the target server or host name.
port — The destination service port number.
You can also redirect the output to a file as follows:
sleep 1 | telnet <server> <port> > output.log
source share