- size_t ret = m_o_socket->Write((const char *)buffer, size).LastCount();
-
- m_lasterror = m_o_socket->Error() ? wxSTREAM_WRITE_ERROR : wxSTREAM_NO_ERROR;
-
- return ret;
+ const size_t ret = m_o_socket->Write(buffer, size).LastCount();
+ m_lasterror = m_o_socket->Error()
+ ? m_o_socket->IsClosed() ? wxSTREAM_EOF
+ : wxSTREAM_WRITE_ERROR
+ : wxSTREAM_NO_ERROR;
+ return ret;