Re: connect(2) for UDP
"Jackson, Craig (Gale)" <[email protected]>
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Message-ID | <[email protected]> |
> I got the idea from Chapter 8.11 of Stevens's "Unix Network Programming", > Volume 1, 3rd edition, page 252. And he says what you said: > > "[T]he kernel just checks for any immediate errors ... records the IP > address and port number of the peer ... and returns immediately to the > calling process." Yep. For UDP, having the other end not be listening is not an immediate error. > The same program, when trying to communicate with a down host, times out > reading. Not surprising, on reflection, because there's no machine to > send that ICMP message. Note that some last-hop routers will make an ICMP Host Unreachable response on a down host, because the ARP fails. I don't know if this will be turned into a useful diagnostic by the UDP layer. In any case, it takes some time for it to decide if the ARP has timed out. Craig