| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] | 
gawk for Network Programming EMISTERED: A host is a host from coast to coast,
and no-one can talk to host that's close,
unless the host that isn't close
is busy hung or dead.
In addition to being able to open a two-way pipeline to a coprocess on the same system (see section Two-Way Communications with Another Process), it is possible to make a two-way connection to another process on another system across an IP networking connection.
You can think of this as just a very long two-way pipeline to
a coprocess.
The way gawk decides that you want to use TCP/IP networking is
by recognizing special file names that begin with `/inet/'.
The full syntax of the special file name is `/inet/protocol/local-port/remote-host/remote-port'. The meaning of the components are:
Caution: The use of raw sockets is not currently supported
in version 3.1 of gawk.
gawk attempts to determine
the pre-defined port number using the C getservbyname function.
Consider the following very simple example:
BEGIN {
  Service = "/inet/tcp/0/localhost/daytime"
  Service |& getline
  print $0
  close(Service)
}
 | 
This program reads the current date and time from the local system's TCP `daytime' server. It then prints the results and closes the connection.
Because this topic is extensive, the use of gawk for
TCP/IP programming is documented separately.
@xref{Top},
See TCP/IP Internetworking with gawk,
which comes as part of the gawk distribution,
for a much more complete introduction and discussion, as well as
extensive examples.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |