Classes | Public Member Functions | Private Attributes | List of all members
FIX::SocketConnector Class Reference

Connects sockets to remote ports and addresses. More...

#include <SocketConnector.h>

Collaboration diagram for FIX::SocketConnector:
Collaboration graph
[legend]

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)
 
SocketMonitorgetMonitor ()
 

Private Attributes

SocketMonitor m_monitor
 

Detailed Description

Connects sockets to remote ports and addresses.

Definition at line 35 of file SocketConnector.h.

Constructor & Destructor Documentation

FIX::SocketConnector::SocketConnector ( int  timeout = 0)

Definition at line 82 of file SocketConnector.cpp.

83 : m_monitor( timeout ) {}
SocketMonitor m_monitor

Member Function Documentation

void FIX::SocketConnector::block ( Strategy strategy,
bool  poll = 0,
double  timeout = 0.0 
)

Definition at line 111 of file SocketConnector.cpp.

References FIX::SocketMonitor::block(), and m_monitor.

Referenced by FIX::SocketInitiator::onPoll(), and FIX::SocketInitiator::onStart().

112 {
113  ConnectorWrapper wrapper( *this, strategy );
114  m_monitor.block( wrapper, poll, timeout );
115 }
void block(Strategy &strategy, bool poll=0, double timeout=0.0)
SocketMonitor m_monitor
int FIX::SocketConnector::connect ( const std::string &  address,
int  port,
bool  noDelay,
int  sendBufSize,
int  rcvBufSize 
)

Definition at line 85 of file SocketConnector.cpp.

References FIX::SocketMonitor::addConnect(), m_monitor, FIX::socket_connect(), FIX::socket_createConnector(), and FIX::socket_setsockopt().

Referenced by connect(), and FIX::SocketInitiator::doConnect().

87 {
88  int socket = socket_createConnector();
89 
90  if ( socket != -1 )
91  {
92  if( noDelay )
93  socket_setsockopt( socket, TCP_NODELAY );
94  if( sendBufSize )
95  socket_setsockopt( socket, SO_SNDBUF, sendBufSize );
96  if( rcvBufSize )
97  socket_setsockopt( socket, SO_RCVBUF, rcvBufSize );
98  m_monitor.addConnect( socket );
99  socket_connect( socket, address.c_str(), port );
100  }
101  return socket;
102 }
int socket_connect(int socket, const char *address, int port)
Definition: Utility.cpp:131
int socket_createConnector()
Definition: Utility.cpp:126
int socket_setsockopt(int s, int opt)
Definition: Utility.cpp:186
bool addConnect(int socket)
SocketMonitor m_monitor
int FIX::SocketConnector::connect ( const std::string &  address,
int  port,
bool  noDelay,
int  sendBufSize,
int  rcvBufSize,
Strategy strategy 
)

Definition at line 104 of file SocketConnector.cpp.

References connect().

106 {
107  int socket = connect( address, port, noDelay, sendBufSize, rcvBufSize );
108  return socket;
109 }
int connect(const std::string &address, int port, bool noDelay, int sendBufSize, int rcvBufSize)
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().

47 { return m_monitor; }
SocketMonitor m_monitor

Member Data Documentation

SocketMonitor FIX::SocketConnector::m_monitor
private

Definition at line 50 of file SocketConnector.h.

Referenced by block(), connect(), and getMonitor().


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

Generated on Sat Mar 29 2014 15:13:35 for QuickFIX by doxygen 1.8.5 written by Dimitri van Heesch, © 1997-2001