- // Connect(addr, true) will wait until the connection completes,
- // returning true on success and false on failure. This call blocks
- // the GUI (this might be changed in future releases to honour the
- // wxSOCKET_BLOCK flag).
- //
- // Connect(addr, false) will issue a nonblocking connection request
- // and return immediately. If the return value is true, then the
- // connection has been already successfully 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 false on timeout, or true if the connection request
- // completes, which in turn might mean:
- //
- // a) That the connection was successfully established
- // b) That the connection request failed (for example, because
- // it was refused by the peer.
- //
- // Use IsConnected() to distinguish between these two.
- //
- // So, in a brief, you should do one of the following things:
- //
- // For blocking Connect:
- //
- // bool success = client->Connect(addr, true);
- //
- // For nonblocking Connect:
- //
- // client->Connect(addr, false);
- //
- // bool waitmore = true;
- // while (! client->WaitOnConnect(seconds, millis) && waitmore )
- // {
- // // possibly give some feedback to the user,
- // // update waitmore if needed.
- // }
- // bool success = client->IsConnected();
- //
- // And that's all :-)