![]() |
Connects sockets to remote ports and addresses. More...
#include <SocketConnector.h>
Classes | |
class | Strategy |
Public Member Functions | |
SocketConnector (int timeout=0) | |
int | connect (const std::string &address, int port, bool noDelay, int sendBufSize, int rcvBufSize) |
int | connect (const std::string &address, int port, bool noDelay, int sendBufSize, int rcvBufSize, Strategy &) |
void | block (Strategy &strategy, bool poll=0, double timeout=0.0) |
SocketMonitor & | getMonitor () |
Private Attributes | |
SocketMonitor | m_monitor |
Connects sockets to remote ports and addresses.
Definition at line 35 of file SocketConnector.h.
FIX::SocketConnector::SocketConnector | ( | int | timeout = 0 |
) |
Definition at line 97 of file SocketConnector.cpp.
00098 : m_monitor( timeout ) {}
void FIX::SocketConnector::block | ( | Strategy & | strategy, | |
bool | poll = 0 , |
|||
double | timeout = 0.0 | |||
) |
Definition at line 140 of file SocketConnector.cpp.
References FIX::SocketMonitor::block(), m_monitor, QF_STACK_POP, and QF_STACK_PUSH.
Referenced by FIX::SocketInitiator::onPoll(), and FIX::SocketInitiator::onStart().
00141 { QF_STACK_PUSH(SocketConnector::block) 00142 00143 ConnectorWrapper wrapper( *this, strategy ); 00144 m_monitor.block( wrapper, poll, timeout ); 00145 00146 QF_STACK_POP 00147 }
int FIX::SocketConnector::connect | ( | const std::string & | address, | |
int | port, | |||
bool | noDelay, | |||
int | sendBufSize, | |||
int | rcvBufSize, | |||
Strategy & | strategy | |||
) |
Definition at line 130 of file SocketConnector.cpp.
References connect(), QF_STACK_POP, and QF_STACK_PUSH.
00132 { QF_STACK_PUSH(SocketConnector::connect) 00133 00134 int socket = connect( address, port, noDelay, sendBufSize, rcvBufSize ); 00135 return socket; 00136 00137 QF_STACK_POP 00138 }
int FIX::SocketConnector::connect | ( | const std::string & | address, | |
int | port, | |||
bool | noDelay, | |||
int | sendBufSize, | |||
int | rcvBufSize | |||
) |
Definition at line 100 of file SocketConnector.cpp.
References FIX::SocketMonitor::addConnect(), m_monitor, QF_STACK_POP, QF_STACK_PUSH, FIX::socket_close(), FIX::socket_connect(), FIX::socket_createConnector(), and FIX::socket_setsockopt().
Referenced by connect(), and FIX::SocketInitiator::doConnect().
00102 { QF_STACK_PUSH(SocketConnector::connect) 00103 00104 int socket = socket_createConnector(); 00105 00106 if ( socket != -1 ) 00107 { 00108 if( noDelay ) 00109 socket_setsockopt( socket, TCP_NODELAY ); 00110 if( sendBufSize ) 00111 socket_setsockopt( socket, SO_SNDBUF, sendBufSize ); 00112 if( rcvBufSize ) 00113 socket_setsockopt( socket, SO_RCVBUF, rcvBufSize ); 00114 00115 if( socket_connect( socket, address.c_str(), port ) < 0 ) 00116 { 00117 socket_close( socket ); 00118 socket = -1; 00119 } 00120 else 00121 { 00122 m_monitor.addConnect( socket ); 00123 } 00124 } 00125 return socket; 00126 00127 QF_STACK_POP 00128 }
SocketMonitor& FIX::SocketConnector::getMonitor | ( | ) | [inline] |
Definition at line 47 of file SocketConnector.h.
References m_monitor.
Referenced by FIX::SocketInitiator::doConnect(), and FIX::SocketConnection::read().
00047 { return m_monitor; }
SocketMonitor FIX::SocketConnector::m_monitor [private] |
Definition at line 50 of file SocketConnector.h.
Referenced by block(), connect(), and getMonitor().