- // Connect(addr, FALSE) will issue a nonblocking connection request
- // and return immediately. If the return value is TRUE, then the
- // connection has been already succesfully established. If it is
- // FALSE, you must wait for the request to complete, either with
- // WaitOnConnect() or by watching wxSOCKET_CONNECTION / LOST
- // events (please read the documentation).
- //
- // WaitOnConnect() itself never blocks the GUI (this might change
- // in the future to honour the wxSOCKET_BLOCK flag). This call will
- // return TRUE if the connection request completed succesfully, or
- // FALSE otherwise, which in turn might mean:
- // a) that the specified timeout ellapsed, or
- // b) that the connection request failed.
- // Use IsConnected() to distinguish between these two.
- //
- // So, in a brief, you should do one of the following things:
- //
- // For blocking Connect:
- //
- // bool success = Connect(addr, TRUE);
- //
- // For nonblocking Connect:
- //
- // Connect(addr, FALSE);
- // WaitOnConnect(seconds, millis);
- // success = IsConnected();
- //
- // And that's all :-)
- //
- m_text->AppendText(_("\nTrying to connect (timeout = 10 sec) ...\n"));
- m_sock->Connect(addr, FALSE);
- m_sock->WaitOnConnect(10);