#include <stdio.h>
#include <stdlib.h>
+
+#ifndef WX_PRECOMP
#include "wx/string.h"
+#include "wx/app.h"
+#endif
+
#include "wx/tokenzr.h"
#include "wx/socket.h"
#include "wx/protocol/protocol.h"
SetHeader(wxT("User-Agent"), wxT("wxWidgets 2.x"));
SaveState();
-#if wxUSE_THREADS
- SetFlags( wxThread::IsMain() ? wxSOCKET_NONE : wxSOCKET_BLOCK );
-#else
- SetFlags( wxSOCKET_NONE );
-#endif
+
+ // we may use non blocking sockets only if we can dispatch events from them
+ SetFlags( wxIsMainThread() && wxApp::IsMainLoopRunning() ? wxSOCKET_NONE
+ : wxSOCKET_BLOCK );
Notify(false);
wxString buf;