On Fri, 09 Nov 2018 at 13:17:11 -0500, Moshe Piekarski wrote: > Performing this test with blank packets still works without the server seeing > anything. > […] > - if ((write(s, "X", 1) != 1) && (errno == ECONNREFUSED)) > + if ((write(s, "", 1) != 1) && (errno == ECONNREFUSED))
That makes the server see a bunch of ‘\0’s instead of ‘X’s; I'd argue that writing control characters is more confusing than writing something visible. OTOH, ‘write(fd, buf, 0)’ has an undefined behavior; in practice an empty message is sent (as for ‘send(s, NULL, 0, 0)’), but receiving an empty buffer is what terminates the poll loop, so if the listening side is `nc -u -l` (without ‘-k’), it closes the socket and exit() before the client has a chance to perform further write()s. -- Guilhem.
signature.asc
Description: PGP signature