Check socket state on write.