+ // 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 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);