Medium
write() to a peer that has already closed
The peer has called close() on its socket, and its FIN has already arrived here, so this side is in CLOSE_WAIT. On Linux, with default signal dispositions, what happens at (1) and (2)?
main.cpp
// Peer's FIN already received; we have not called close().
ssize_t a = write(fd, "hello", 5); // (1)
usleep(100000); // peer's response to (1) arrives meanwhile
ssize_t b = write(fd, "world", 5); // (2)31 of 45 in Networking