don't check for connected state of UDP sockets which are never connected (closes #10717)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60576 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2009-05-09 17:26:35 +00:00
parent 3b84c8078e
commit d34f724d42

View File

@@ -950,7 +950,9 @@ wxUint32 wxSocketBase::DoRead(void* buffer_, wxUint32 nbytes)
// events and, even more importantly, we must do this under Windows // events and, even more importantly, we must do this under Windows
// where we're not going to get notifications about socket being ready // where we're not going to get notifications about socket being ready
// for reading before we read all the existing data from it // for reading before we read all the existing data from it
const int ret = m_connected ? m_impl->Read(buffer, nbytes) : 0; const int ret = !m_impl->m_stream || m_connected
? m_impl->Read(buffer, nbytes)
: 0;
if ( ret == -1 ) if ( ret == -1 )
{ {
if ( m_impl->GetLastError() == wxSOCKET_WOULDBLOCK ) if ( m_impl->GetLastError() == wxSOCKET_WOULDBLOCK )
@@ -1115,7 +1117,7 @@ wxUint32 wxSocketBase::DoWrite(const void *buffer_, wxUint32 nbytes)
wxUint32 total = 0; wxUint32 total = 0;
while ( nbytes ) while ( nbytes )
{ {
if ( !m_connected ) if ( m_impl->m_stream && !m_connected )
{ {
if ( (m_flags & wxSOCKET_WAITALL) || !total ) if ( (m_flags & wxSOCKET_WAITALL) || !total )
SetError(wxSOCKET_IOERR); SetError(wxSOCKET_IOERR);