From 0f359e5ccf10506edb4f0f98468db962a8e4fd79 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 1 Jan 2009 23:56:52 +0000 Subject: [PATCH] fix a bug in EventWorker::DoRead(): if both signature and the size of the incoming data were not received during the same read, the signature byte was lost and overwritten by size during the next read git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57718 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- samples/sockets/baseserver.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/samples/sockets/baseserver.cpp b/samples/sockets/baseserver.cpp index 047327d03c..c74ef28666 100644 --- a/samples/sockets/baseserver.cpp +++ b/samples/sockets/baseserver.cpp @@ -598,7 +598,7 @@ EventWorker::DoRead() //read message header do { - m_socket->Read(m_signature,2 - m_infill); + m_socket->Read(m_signature + m_infill, 2 - m_infill); if (m_socket->Error()) { if (m_socket->LastError() != wxSOCKET_WOULDBLOCK) @@ -630,7 +630,8 @@ EventWorker::DoRead() m_written = 0; LogWorker(wxString::Format("Message signature: len: %d, type: %s, size: %d (bytes)",chunks,type == 0xBE ? "b" : "kB",m_size)); break; - } else + } + else { LogWorker(wxString::Format("Unknown test type %x",type)); m_socket->Close(); -- 2.47.2