Open Lighting Architecture  0.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Types | Public Member Functions | List of all members
ola::network::TCPConnector Class Reference

Detailed Description

An class which manages non-blocking TCP connects.

Classes

class  PendingTCPConnection

Public Types

typedef
ola::SingleUseCallback2< void,
int, int > 
TCPConnectCallback
typedef const void * TCPConnectionID

Public Member Functions

 TCPConnector (ola::io::SelectServerInterface *ss)
 ~TCPConnector ()
TCPConnectionID Connect (const IPV4SocketAddress &endpoint, const ola::TimeInterval &timeout, TCPConnectCallback *callback)
bool Cancel (TCPConnectionID id)
void CancelAll ()
unsigned int ConnectionsPending () const

Constructor & Destructor Documentation

ola::network::TCPConnector::~TCPConnector ( )

Clean up

Member Function Documentation

bool ola::network::TCPConnector::Cancel ( TCPConnectionID  id)

Cancel a pending TCP connection

Parameters
idthe TCPConnectionID
Returns
true if this connection was cancelled, false if the id wasn't valid.
void ola::network::TCPConnector::CancelAll ( )

Abort all pending TCP connections

TCPConnector::TCPConnectionID ola::network::TCPConnector::Connect ( const IPV4SocketAddress endpoint,
const ola::TimeInterval timeout,
TCPConnectCallback callback 
)

Perform a non-blocking connect. on_connect may be called immediately if the address is local. on_failure will be called immediately if an error occurs

Parameters
endpointthe IPV4SocketAddress to connect to
timeoutthe time to wait before declaring the connection a failure
callbackthe callback to run when the connection completes or fails
Returns
the ID for this connection, or 0 if the callback has already run.

The documentation for this class was generated from the following files: