echo Hello world! | (exec 3<>/dev/tcp/; cat >&3; cat <&3;
 exec 3<&-)

The redirection operator [n]<>word causes the file whose name is the expansion of word to be opened for both reading and writing on file descriptor n

  1. open new descriptor

If host is a valid hostname or Internet address, and port is an integer port number or service name, Bash attempts to open the corresponding TCP socket

  1. redirect cat output to socket
  2. redirect response to cat input

If >&- or <&- is preceded by {varname}, the value of varname defines the file descriptor to close.

  1. close


Updated 02 January 2023