(gawkinet.info.gz) Gawk Special Files

Info Catalog (gawkinet.info.gz) Using Networking (gawkinet.info.gz) Using Networking (gawkinet.info.gz) TCP Connecting
 
 2.1 `gawk''s Networking Mechanisms
 ==================================
 
 The `|&' operator introduced in `gawk' 3.1 for use in communicating
 with a "coprocess" is 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, sending it data with `print' or `printf' and reading
 data with `getline'.  If you haven't read it already, you should detour
 there to do so.
 
    `gawk' transparently extends the two-way I/O mechanism to simple
 networking through the use of special file names.  When a "coprocess"
 that matches the special files we are about to describe is started,
 `gawk' creates the appropriate network connection, and then two-way I/O
 proceeds as usual.
 
    At the C, C++, and Perl level, networking is accomplished via
 "sockets", an Application Programming Interface (API) originally
 developed at the University of California at Berkeley that is now used
 almost universally for TCP/IP networking.  Socket level programming,
 while fairly straightforward, requires paying attention to a number of
 details, as well as using binary data.  It is not well-suited for use
 from a high-level language like `awk'.  The special files provided in
 `gawk' hide the details from the programmer, making things much simpler
 and easier to use.
 
    The special file name for network access is made up of several
 fields, all of which are mandatory:
 
      /inet/PROTOCOL/LOCALPORT/HOSTNAME/REMOTEPORT
 
    The `/inet/' field is, of course, constant when accessing the
 network.  The LOCALPORT and REMOTEPORT fields do not have a meaning
 when used with `/inet/raw' because "ports" only apply to TCP and UDP.
 So, when using `/inet/raw', the port fields always have to be `0'.
 

Menu

 
* Special File Fields         The fields in the special file name.
* Comparing Protocols         Differences between the protocols.
 
Info Catalog (gawkinet.info.gz) Using Networking (gawkinet.info.gz) Using Networking (gawkinet.info.gz) TCP Connecting
automatically generated by info2html