![]() |
![]() |
|
Index
Source Files
Annotated Class List
Alphabetical Class List
Class Hierarchy
Graphical Class Hierarchy
|
||
![]() |
![]() |
#include <SocketServer.h>
Collaboration diagram for FIX::SocketServer:

Public Member Functions | |
| SocketServer (int timeout=0) | |
| int | add (int port, bool reuse=false, bool noDelay=false) |
| int | accept (int socket) |
| void | close () |
| bool | block (Strategy &strategy, bool poll=0) |
| int | numConnections () |
| SocketMonitor & | getMonitor () |
| int | socketToPort (int socket) |
| int | portToSocket (int port) |
Private Types | |
| typedef std::map< int, SocketInfo > | SocketToInfo |
| typedef std::map< int, SocketInfo > | PortToInfo |
Private Attributes | |
| SocketToInfo | m_socketToInfo |
| PortToInfo | m_portToInfo |
| SocketMonitor | m_monitor |
Definition at line 50 of file SocketServer.h.
|
|
Definition at line 72 of file SocketServer.h. |
|
|
Definition at line 70 of file SocketServer.h. |
|
|
Definition at line 103 of file SocketServer.cpp.
00104 : m_monitor( timeout ) {} |
|
|
Definition at line 124 of file SocketServer.cpp. References FIX::SocketMonitor::addConnect(), FIX::SocketInfo::m_noDelay, m_socketToInfo, QF_STACK_POP, QF_STACK_PUSH, FIX::socket_accept(), and FIX::socket_setsockopt(). Referenced by FIX::ServerWrapper::onEvent().
00125 { QF_STACK_PUSH(SocketServer::accept)
00126
00127 SocketInfo info = m_socketToInfo[socket];
00128
00129 int result = socket_accept( socket );
00130 if( info.m_noDelay )
00131 socket_setsockopt( result, TCP_NODELAY );
00132 if ( result >= 0 )
00133 m_monitor.addConnect( result );
00134 return result;
00135
00136 QF_STACK_POP
00137 }
|
|
||||||||||||||||
|
Definition at line 106 of file SocketServer.cpp. References FIX::SocketMonitor::addRead(), m_portToInfo, m_socketToInfo, FIX::socket_createAcceptor(), and FIX::socket_setsockopt().
00107 {
00108 if( m_portToInfo.find(port) != m_portToInfo.end() )
00109 return m_portToInfo[port].m_socket;
00110
00111 int socket = socket_createAcceptor( port, reuse );
00112 if( socket < 0 )
00113 throw std::exception();
00114 if( noDelay )
00115 socket_setsockopt( socket, TCP_NODELAY );
00116 m_monitor.addRead( socket );
00117
00118 SocketInfo info( socket, port, noDelay );
00119 m_socketToInfo[socket] = info;
00120 m_portToInfo[port] = info;
00121 return socket;
00122 }
|
|
||||||||||||
|
Definition at line 153 of file SocketServer.cpp. References FIX::SocketMonitor::block(), m_socketToInfo, QF_STACK_POP, QF_STACK_PUSH, and FIX::socket_isValid(). Referenced by FIX::SocketAcceptor::onPoll(), and FIX::SocketAcceptor::onStart().
00154 { QF_STACK_PUSH(SocketServer::block)
00155
00156 std::set<int> sockets;
00157 SocketToInfo::iterator i = m_socketToInfo.begin();
00158 for( ; i != m_socketToInfo.end(); ++i )
00159 {
00160 if( !socket_isValid(i->first) )
00161 return false;
00162 sockets.insert( i->first );
00163 }
00164
00165 ServerWrapper wrapper( sockets, *this, strategy );
00166 m_monitor.block( wrapper, poll );
00167 return true;
00168
00169 QF_STACK_POP
00170 }
|
|
|
Definition at line 139 of file SocketServer.cpp. References m_socketToInfo, QF_STACK_POP, QF_STACK_PUSH, FIX::socket_close(), and FIX::socket_invalidate(). Referenced by FIX::SocketAcceptor::onStart().
00140 { QF_STACK_PUSH(SocketServer::close)
00141
00142 SocketToInfo::iterator i = m_socketToInfo.begin();
00143 for( ; i != m_socketToInfo.end(); ++i )
00144 {
00145 int s = i->first;
00146 socket_close( s );
00147 socket_invalidate( s );
00148 }
00149
00150 QF_STACK_POP
00151 }
|
|
|
Definition at line 63 of file SocketServer.h. Referenced by FIX::SocketAcceptor::onConnect(), FIX::ServerWrapper::onError(), and FIX::SocketConnection::read().
00063 { return m_monitor; }
|
|
|
Definition at line 62 of file SocketServer.h. References FIX::SocketMonitor::numSockets().
00062 { return m_monitor.numSockets() - 1; }
|
|
|
Definition at line 179 of file SocketServer.cpp. References m_portToInfo.
00180 {
00181 SocketToInfo::iterator find = m_portToInfo.find( port );
00182 if( find == m_portToInfo.end() ) return 0;
00183 return find->second.m_socket;
00184 }
|
|
|
Definition at line 172 of file SocketServer.cpp. References m_socketToInfo. Referenced by FIX::SocketAcceptor::onConnect().
00173 {
00174 SocketToInfo::iterator find = m_socketToInfo.find( socket );
00175 if( find == m_socketToInfo.end() ) return 0;
00176 return find->second.m_port;
00177 }
|
|
|
Definition at line 76 of file SocketServer.h. |
|
|
Definition at line 75 of file SocketServer.h. Referenced by add(), and portToSocket(). |
|
|
Definition at line 74 of file SocketServer.h. Referenced by accept(), add(), block(), close(), and socketToPort(). |
1.3.6-20040222 written by Dimitri van Heesch,
© 1997-2001