gawkinet: File /inet/tcp

1 
1 2.1.2.1 '/inet/tcp'
1 ...................
1 
1 Once again, always use TCP. (Use UDP when low overhead is a necessity,
1 and use RAW for network experimentation.)  The first example is the
1 sender program:
1 
1      # Server
1      BEGIN {
1        print strftime() |& "/inet/tcp/8888/0/0"
1        close("/inet/tcp/8888/0/0")
1      }
1 
1    The receiver is very simple:
1 
1      # Client
1      BEGIN {
1        "/inet/tcp/0/localhost/8888" |& getline
1        print $0
1        close("/inet/tcp/0/localhost/8888")
1      }
1 
1    TCP guarantees that the bytes arrive at the receiving end in exactly
1 the same order that they were sent.  No byte is lost (except for broken
1 connections), doubled, or out of order.  Some overhead is necessary to
1 accomplish this, but this is the price to pay for a reliable service.
1 It does matter which side starts first.  The sender/server has to be
1 started first, and it waits for the receiver to read a line.
1