manpagez: man pages & more
info gawkinet
Home | html | info | man
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ] ‘/inet/udp

The server and client programs that use UDP are almost identical to their TCP counterparts; only the protocol has changed. As before, it does matter which side starts first. The receiving side blocks and waits for the sender. In this case, the receiver/client has to be started first:

# Server
  print strftime() |& "/inet/udp/8888/0/0"

The receiver is almost identical to the TCP receiver:

# Client
  "/inet/udp/0/localhost/8888" |& getline
  print $0

UDP cannot guarantee that the datagrams at the receiving end will arrive in exactly the same order they were sent. Some datagrams could be lost, some doubled, and some out of order. But no overhead is necessary to accomplish this. This unreliable behavior is good enough for tasks such as data acquisition, logging, and even stateless services like NFS.

© 2000-2019
Individual documents may contain additional copyright information.