SOCKET_INITIALIZER_MIXIN Class Reference

TCP/IP socket based server for RemoteDatabase. More...

#include <tcpserver.h>

List of all members.

Public Member Functions

 TcpServer (const std::vector< std::string > &dbpaths_, const std::string &host, int port, int msecs_active_timeout, int msecs_idle_timeout, bool writable, bool verbose)
 Construct a TcpServer for a Database and start listening for connections.
 ~TcpServer ()
 Destructor.
void run ()
 Accept connections and service requests indefinitely.
void run_once ()
 Accept a single connection, service requests on it, then stop.
void handle_one_connection (int socket)
 Handle a single connection on an already connected socket.

Private Member Functions

void operator= (const TcpServer &)
 Don't allow assignment.
 TcpServer (const TcpServer &)
 Don't allow copying.
int accept_connection ()
 Accept a connection and return the filedescriptor for it.

Static Private Member Functions

static int get_listening_socket (const std::string &host, int port)
 Create a listening socket ready to accept connections.

Private Attributes

const std::vector< std::string > dbpaths
 Paths to the databases we will open.
bool writable
 Is this a WritableDatabase?
int listen_socket
 The socket we're listening on.
int msecs_active_timeout
 Timeout between messages during a single operation (in milliseconds).
int msecs_idle_timeout
 Timeout between operations (in milliseconds).
bool verbose
 Should we produce output when connections are made or lost?


Detailed Description

TCP/IP socket based server for RemoteDatabase.

This class implements the server used by xapian-tcpsrv.

Definition at line 42 of file tcpserver.h.


Constructor & Destructor Documentation

SOCKET_INITIALIZER_MIXIN::~TcpServer (  ) 

Destructor.


Member Function Documentation

void SOCKET_INITIALIZER_MIXIN::operator= ( const TcpServer &   )  [private]

Don't allow assignment.

SOCKET_INITIALIZER_MIXIN::TcpServer ( const TcpServer &   )  [private]

Don't allow copying.

static int SOCKET_INITIALIZER_MIXIN::get_listening_socket ( const std::string &  host,
int  port 
) [static, private]

Create a listening socket ready to accept connections.

Parameters:
host hostname or address to listen on or an empty string to accept connections on any interface.
port TCP port to listen on.

int SOCKET_INITIALIZER_MIXIN::accept_connection (  )  [private]

Accept a connection and return the filedescriptor for it.

SOCKET_INITIALIZER_MIXIN::TcpServer ( const std::vector< std::string > &  dbpaths_,
const std::string &  host,
int  port,
int  msecs_active_timeout,
int  msecs_idle_timeout,
bool  writable,
bool  verbose 
)

Construct a TcpServer for a Database and start listening for connections.

Parameters:
dbpaths_ The path(s) to the database(s) we should open.
host The hostname or address for the interface to listen on (or "" to listen on all interfaces). The TCP port number to listen on.
msecs_active_timeout Timeout between messages during a single operation (in milliseconds).
msecs_idle_timeout Timeout between operations (in milliseconds).
writable Should we open the DB for writing?
verbose Should we produce output when connections are made or lost?

void SOCKET_INITIALIZER_MIXIN::run (  ) 

Accept connections and service requests indefinitely.

This method runs the TcpServer as a daemon which accepts a connection and forks itself (or creates a new thread under Windows) to serve the request while continuing to listen for more connections.

void SOCKET_INITIALIZER_MIXIN::run_once (  ) 

Accept a single connection, service requests on it, then stop.

void SOCKET_INITIALIZER_MIXIN::handle_one_connection ( int  socket  ) 

Handle a single connection on an already connected socket.

socket will be closed before returning. This method may be called by multiple threads.


Member Data Documentation

const std::vector<std::string> SOCKET_INITIALIZER_MIXIN::dbpaths [private]

Paths to the databases we will open.

Contains exactly one entry if writable, and at least one if not.

Definition at line 53 of file tcpserver.h.

bool SOCKET_INITIALIZER_MIXIN::writable [private]

Is this a WritableDatabase?

Definition at line 56 of file tcpserver.h.

int SOCKET_INITIALIZER_MIXIN::listen_socket [private]

The socket we're listening on.

Definition at line 64 of file tcpserver.h.

int SOCKET_INITIALIZER_MIXIN::msecs_active_timeout [private]

Timeout between messages during a single operation (in milliseconds).

Definition at line 67 of file tcpserver.h.

int SOCKET_INITIALIZER_MIXIN::msecs_idle_timeout [private]

Timeout between operations (in milliseconds).

Definition at line 70 of file tcpserver.h.

bool SOCKET_INITIALIZER_MIXIN::verbose [private]

Should we produce output when connections are made or lost?

Definition at line 73 of file tcpserver.h.


The documentation for this class was generated from the following file:
Documentation for Xapian (version 1.0.10).
Generated on 24 Dec 2008 by Doxygen 1.5.2.