25.4 Summary
Signal-driven I/O has the kernel notify us with the SIGIO signal when "something" happens on a socket.
With a connected TCP socket, numerous conditions can cause this notification, making this feature of little use. With a listening TCP socket, this notification occurs when a new connection is ready to be accepted. With UDP, this notification means either a datagram has arrived or an asynchronous error has arrived; in both cases, we call recvfrom.
We modified our UDP echo server to use signal-driven I/O, using a technique similar to that used by NTP: read a datagram as soon as possible after it arrives to obtain an accurate timestamp for its arrival and then queue it for later processing.
|