FIX::SocketConnector Class Reference

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

`#include <SocketConnector.h>`

Collaboration diagram for FIX::SocketConnector:
[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, const std::string &sourceAddress="", int sourcePort=0)
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

## Detailed Description

Connects sockets to remote ports and addresses.

Definition at line 35 of file SocketConnector.h.

## Constructor & Destructor Documentation

## SocketConnector()

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

Definition at line 82 of file SocketConnector.cpp.

: m_monitor( timeout ) {}
FIX::SocketConnector::m_monitor
SocketMonitor m_monitor
Definition SocketConnector.h:51

## Member Function Documentation

## block()

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

Definition at line 114 of file SocketConnector.cpp.

{
ConnectorWrapper wrapper( *this, strategy );
m_monitor.block( wrapper, poll, timeout );
}
FIX::SocketMonitor::block
void block(Strategy &strategy, bool poll=0, double timeout=0.0)
Definition SocketMonitor.cpp:181

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

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

## connect() [1/2]

int FIX::SocketConnector::connect | ( | const std::string & | address,
|  | int | port,
|  | bool | noDelay,
|  | int | sendBufSize,
|  | int | rcvBufSize,
|  | const std::string & | sourceAddress = `""`,
|  | int | sourcePort = `0`
| ) |  |

Definition at line 85 of file SocketConnector.cpp.

{
int socket = socket_createConnector();
if ( socket != -1 )
{
if( noDelay )
socket_setsockopt( socket, TCP_NODELAY );
if( sendBufSize )
socket_setsockopt( socket, SO_SNDBUF, sendBufSize );
if( rcvBufSize )
socket_setsockopt( socket, SO_RCVBUF, rcvBufSize );
if ( !sourceAddress.empty() || sourcePort )
socket_bind( socket, sourceAddress.c_str(), sourcePort );
m_monitor.addConnect( socket );
socket_connect( socket, address.c_str(), port );
}
return socket;
}
FIX::SocketMonitor::addConnect
bool addConnect(int socket)
Definition SocketMonitor.cpp:65
FIX::socket_setsockopt
int socket_setsockopt(int s, int opt)
Definition Utility.cpp:208
FIX::socket_createConnector
int socket_createConnector()
Definition Utility.cpp:143
FIX::socket_connect
int socket_connect(int socket, const char *address, int port)
Definition Utility.cpp:148
FIX::socket_bind
int socket_bind(int socket, const char *hostname, int port)
Definition Utility.cpp:103

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

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

## connect() [2/2]

int FIX::SocketConnector::connect | ( | const std::string & | address,
|  | int | port,
|  | bool | noDelay,
|  | int | sendBufSize,
|  | int | rcvBufSize,
|  | Strategy & | strategy
| ) |  |

Definition at line 107 of file SocketConnector.cpp.

{
int socket = connect( address, port, noDelay, sendBufSize, rcvBufSize, "", 0);
return socket;
}
FIX::SocketConnector::connect
int connect(const std::string &address, int port, bool noDelay, int sendBufSize, int rcvBufSize, const std::string &sourceAddress="", int sourcePort=0)
Definition SocketConnector.cpp:85

References connect().

## getMonitor()

SocketMonitor & FIX::SocketConnector::getMonitor | ( |  | ) |

inline

Definition at line 48 of file SocketConnector.h.

{ return m_monitor; }

References m_monitor.

Referenced by FIX::SocketInitiator::doConnect(), and FIX::SocketConnection::read().

## Member Data Documentation

## m_monitor

SocketMonitor FIX::SocketConnector::m_monitor

private

Definition at line 51 of file SocketConnector.h.

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

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

- SocketConnector.h
- SocketConnector.cpp