Code: Select all
m_socket = new wxSocketClient(wxSOCKET_BLOCK|wxSOCKET_WAITALL);
m_socket->Notify(false); //disables socket events
wxIPV4address addr;
addr.AnyAddress();
addr.Service(port);
if(m_socket->Connect(addr, true))
{
wxPuts(wxString::Format("Connected to port %d", port));
}
Since thread is already in blocked mode I wonder what is going on. Can someone help me understand why is it complaining that?../src/common/socket.cpp(1984): assert "(flags & wxSOCKET_BLOCK) || wxIsMainThread()" failed in wxSocketClient(): Non-blocking sockets may only be created in the main thread [in thread 70000611d000]
Here is a relevant callstack
Call stack:
[01] wxSocketClient::wxSocketClient(int) socket.cpp:1982
[02] wxSocketClient::wxSocketClient(int) socket.cpp:1988