- // Create a socket listening on specified port
- server = new wxSocketServer(addr, SCKIPC_FLAGS);
- server->SetEventHandler(*gs_handler, _SERVER_ONREQUEST_ID);
- server->SetClientData(this);
- server->SetNotify(wxSOCKET_CONNECTION_FLAG);
- server->Notify(TRUE);
+ // Create a socket listening on the specified port
+ m_server = new wxSocketServer(addr, SCKIPC_FLAGS);
+
+ if (!m_server->Ok())
+ {
+ m_server->Destroy();
+ m_server = NULL;
+
+ return FALSE;
+ }
+
+ m_server->SetEventHandler(*gs_handler, _SERVER_ONREQUEST_ID);
+ m_server->SetClientData(this);
+ m_server->SetNotify(wxSOCKET_CONNECTION_FLAG);
+ m_server->Notify(TRUE);