check to make sure the socket is writable before writing to it