gawk allows you to open a two-way pipe to another process, called a coprocess. This is done with the |& operator used with getline and print or printf.
database command|& "db_server" "db_server" |& getline response
If the command used with |& is a filename beginning with /inet/, gawk opens a TCP/IP connection. The filename should be of the following form:
The parts of the filename are:
One of tcp, udp or raw, for TCP, UDP, or raw IP sockets, respectively. Note: raw is currently reserved but unsupported.
The local TCP or UPD port number to use. Use 0 to let the operating system pick a port.
The name or IP address of the remote host to connect to.
The port (application) on the remote host to connect to. A service name (e.g., tftp) is looked up using the C getservbyname( ) function.