Earlier today I noticed some calls to php fwrite failing as the destination socket was in a mixed state. There were numerous connections stuck in SYN_SENT and were seemingly not coming back as failures.
What is the best way to detect this and simply time out the connection if x bits haven't bit transmitted over the wire?