Inheritance diagram for GNE::ClientConnection:
|typedef SmartPtr< ClientConnection >||sptr|
|typedef WeakPtr< ClientConnection >||wptr|
Public Member Functions
|bool||open (const Address &dest, const ConnectionParams &p)|
|Opens the socket, ready for connect, but does not yet connect. |
|Starts connection to the specified target. |
|Waits indefinitely for the connection attempt started by connect to finish. |
Static Public Member Functions
|static sptr||create ()|
|Creates a new ClientConnection object, managed by a SmartPtr. |
Protected Member Functions
|Initializes this ClientConnection. |
|class||boost::weak_ptr< Thread >|
|class||boost::shared_ptr< Thread >|
|class||boost::weak_ptr< Connection >|
|class||boost::shared_ptr< Connection >|
Starts connection to the specified target.
This method does not block, and a thread will be started to handle the connection process. onConnect() or onConnectFailure() will be called depending on the outcome of this process. The exception is that if an error occurs during onConnect or it chooses to reject the connection, onConnectFailure will also be called.
You can call waitForConnect after connect to wait until the connection is finished, when onConnect or onConnectFailure will be called. When the called function exits, the thread will stop and waitForConnect will return.
The version number for the library and your own version number will be checked during this phase. If either protocol versions mismatch, onConnectFailure() will be triggered.
Connection's state is Connecting (but may change immedately after to another state).
the open method succeeded.
Opens the socket, ready for connect, but does not yet connect.
All of the relvant parameters for establishing the connection are passed into this function. If there is an error, the function returns true.
|dest||the destination address.|
Waits indefinitely for the connection attempt started by connect to finish.
When the attempt finishes, the result of the connection attempt is returned. If the connection was successful, an error code of Error::NoError is returned.
This is the same Error that is passed to onConnectFailure.
Multiple threads may call this method at any time, even after connection completes (and the return will always be the same). If the connection has already completed this method will return instantly.