FIX::SocketConnector Class Reference

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

#include <SocketConnector.h>

Collaboration diagram for FIX::SocketConnector:

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

◆ SocketConnector()

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.

115{
116 ConnectorWrapper wrapper( *this, strategy );
117 m_monitor.block( wrapper, poll, timeout );
118}

References m_monitor.

◆ 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.

88{
89 int socket = socket_createConnector();
90
91 if ( socket != -1 )
92 {
93 if( noDelay )
94 socket_setsockopt( socket, TCP_NODELAY );
95 if( sendBufSize )
96 socket_setsockopt( socket, SO_SNDBUF, sendBufSize );
97 if( rcvBufSize )
98 socket_setsockopt( socket, SO_RCVBUF, rcvBufSize );
99 if ( !sourceAddress.empty() || sourcePort )
100 socket_bind( socket, sourceAddress.c_str(), sourcePort );
101 m_monitor.addConnect( socket );
102 socket_connect( socket, address.c_str(), port );
103 }
104 return socket;
105}
int socket_setsockopt(int s, int opt)
Definition Utility.cpp:208
int socket_createConnector()
Definition Utility.cpp:143
int socket_connect(int socket, const char *address, int port)
Definition Utility.cpp:148
int socket_bind(int socket, const char *hostname, int port)
Definition Utility.cpp:103

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

Referenced by connect().

◆ 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.

109{
110 int socket = connect( address, port, noDelay, sendBufSize, rcvBufSize, "", 0);
111 return socket;
112}
int connect(const std::string &address, int port, bool noDelay, int sendBufSize, int rcvBufSize, const std::string &sourceAddress="", int sourcePort=0)

References connect().

◆ getMonitor()

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

Definition at line 48 of file SocketConnector.h.

48{ return m_monitor; }

References m_monitor.

Referenced by 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(), getMonitor(), and SocketConnector().


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

Generated on for QuickFIX by doxygen 1.15.0 written by Dimitri van Heesch, © 1997-2001