#include <ClientConnection.h>
Inheritance diagram for GNE::ClientConnection:
Public Types | |
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. | |
void | connect () |
Starts connection to the specified target. | |
Error | waitForConnect () |
Waits indefinitely for the connection attempt started by connect to finish. | |
Static Public Member Functions | |
sptr | create () |
Creates a new ClientConnection object, managed by a SmartPtr. | |
Protected Member Functions | |
ClientConnection () | |
Initializes this ClientConnection. | |
Friends | |
class | SyncConnection |
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.
|
|
Creates a new ClientConnection object, managed by a SmartPtr. The listener is passed in the open method. |
|
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.
|
|
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.
|