+ // Mini-tutorial for Connect() :-)
+ // ---------------------------
+ //
+ // There are two ways to use Connect(): blocking and non-blocking,
+ // depending on the value passed as the 'wait' (2nd) parameter.
+ //
+ // 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 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 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 :-)
+
+ m_text->AppendText(_("\nTrying to connect (timeout = 10 sec) ...\n"));