Code: Select all
wxSocketClient socket;
socket.SetFlags(wxSOCKET_NONE);
.....
wxCharBuffer buf(1024);
socket.Read(buf.data(), 1024);
Code: Select all
socket.Peek(buf.data(), 1024);
but it does not explain which flags should be used for Peek, and the ones I tried did not get any result.The exact behaviour of Peek() depends on the combination of flags being used. For a detailed explanation, see SetFlags()
Debugging the Peek function (Windows), in
Code: Select all
wxUint32 wxSocketBase::DoRead(void* buffer_, wxUint32 nbytes)
...
const int ret = !m_impl->m_stream || m_connected
? m_impl->Read(buffer, nbytes)
: 0;
if ( ret == -1 )
{
if ( m_impl->GetLastError() == wxSOCKET_WOULDBLOCK )
{
// if we don't want to wait, just return immediately
if ( m_flags & wxSOCKET_NOWAIT_READ )
{
// this shouldn't be counted as an error in this case
SetError(wxSOCKET_NOERROR);
Code: Select all
SetError(wxSOCKET_NOERROR);