Below, wxString host is passed from a modal dialog with a wxTextCtrl as:
if (UI->DoConnect(text_address->GetValue())) {
The wxMessageBox does indeed show the right address, yay.
connection->Connect is the call that dies with a segfault. gdb doesn't drill into the Connect call, so it's got to be that connection doesn't exist (or something like that)
Code: Select all
bool UI::DoConnect(wxString host)
{
wxIPV4address addr;
addr.Hostname(host);
addr.Service(4242);
//(void)wxMessageBox((addr.Hostname()).c_str(), _T("test"), wxICON_INFORMATION);
connection->Connect(addr, false);
connection->WaitOnConnect(10);
if (connection->IsConnected())
return true;
else
return false;
}
Code: Select all
// Create the socket
connection = new wxSocketClient();
// Setup the event handler and subscribe to most events
connection->SetEventHandler(*this, Socket_ID);
connection->SetNotify(wxSOCKET_CONNECTION_FLAG |
wxSOCKET_INPUT_FLAG |
wxSOCKET_LOST_FLAG);
connection->Notify(true);
So why is connection->Connect() dying ??!?