gawkinet: Gawk Special Files

1 
1 2.1 'gawk''s Networking Mechanisms
1 ==================================
1 
1 The '|&' operator for use in communicating with a "coprocess" is
11 described in ⇒Two-way Communications With Another Process
 (gawk)Two-way I/O. It shows how to do two-way I/O to a separate process,
1 sending it data with 'print' or 'printf' and reading data with
1 'getline'.  If you haven't read it already, you should detour there to
1 do so.
1 
1    'gawk' transparently extends the two-way I/O mechanism to simple
1 networking through the use of special file names.  When a "coprocess"
1 that matches the special files we are about to describe is started,
1 'gawk' creates the appropriate network connection, and then two-way I/O
1 proceeds as usual.
1 
1    At the C, C++, and Perl level, networking is accomplished via
1 "sockets", an Application Programming Interface (API) originally
1 developed at the University of California at Berkeley that is now used
1 almost universally for TCP/IP networking.  Socket level programming,
1 while fairly straightforward, requires paying attention to a number of
1 details, as well as using binary data.  It is not well-suited for use
1 from a high-level language like 'awk'.  The special files provided in
1 'gawk' hide the details from the programmer, making things much simpler
1 and easier to use.
1 
1    The special file name for network access is made up of several
1 fields, all of which are mandatory:
1 
1      /NET-TYPE/PROTOCOL/LOCALPORT/HOSTNAME/REMOTEPORT
1 
1    The NET-TYPE field lets you specify IPv4 versus IPv6, or lets you
1 allow the system to choose.
1 

Menu