Vault  4.1
Public Member Functions
VSocketConnectionStrategyThreaded Class Reference

Connects to the all DNS resolved IP addresses for a host name, in parallel batches, until one succeeds or a specified timeout is reached. More...

#include <vsocket.h>

Inheritance diagram for VSocketConnectionStrategyThreaded:
VSocketConnectionStrategy

List of all members.

Public Member Functions

 VSocketConnectionStrategyThreaded (const VDuration &timeoutInterval, int maxNumThreads=4)
virtual void connect (const VString &hostName, int portNumber, VSocket &socketToConnect) const
 The VSocketConnectionStrategy interface to be implemented by concrete subclasses.

Detailed Description

Connects to the all DNS resolved IP addresses for a host name, in parallel batches, until one succeeds or a specified timeout is reached.

This strategy makes most sense with IPv6 where DNS is supposed to return a preferred-order list of resolved names (rather than round- robining) but where we have an opportunity to use the one that responds fastest.

Definition at line 635 of file vsocket.h.


Member Function Documentation

void VSocketConnectionStrategyThreaded::connect ( const VString hostName,
int  portNumber,
VSocket socketToConnect 
) const [virtual]

The VSocketConnectionStrategy interface to be implemented by concrete subclasses.

Connects to the host name by resolving it and then applying the strategy to the resolved IP addresses. If the strategy fails (for whatever reason, be it a connect failure or a timeout) it shall throw a VException.

Parameters:
hostNamethe name to resolve and connect to
portNumberthe port number to connect to
socketToConnectif successful, this Vault socket object is to be mutated upon return to have the connected socket's host IP address and low-level VSocketID; for simple non-threaded strategies it is acceptable to simply call this object's connectToIPAddress() and leave the results in place if successful

Implements VSocketConnectionStrategy.

Definition at line 987 of file vsocket.cpp.

References VString::chars(), VSocket::getHostIPAddress(), VSocket::kNoSocketID, VSocketConnectionStrategy::mDebugIPAddresses, VDuration::MILLISECOND(), NULL, VSocket::setHostIPAddressAndPort(), VSocket::setSockID(), VThread::sleep(), and VThread::start().


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

Copyright ©1997-2014 Trygve Isaacson. All rights reserved. This documentation was generated with Doxygen.