xapian-core  2.0.0
Macros | Functions
tcpserver.cc File Reference

Generic TCP/IP socket based server base class. More...

#include <config.h>
#include "tcpserver.h"
#include <xapian/error.h>
#include "resolver.h"
#include "socket_utils.h"
#include "safefcntl.h"
#include "safenetdb.h"
#include "safesysexits.h"
#include "safesysselect.h"
#include "safesyssocket.h"
#include "safeunistd.h"
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <signal.h>
#include <sys/wait.h>
#include <iostream>
#include <limits>
#include <cerrno>
#include <cstring>
#include <cstdlib>
#include <sys/types.h>
+ Include dependency graph for tcpserver.cc:

Go to the source code of this file.

Macros

#define LISTEN_BACKLOG   5
 

Functions

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

Detailed Description

Generic TCP/IP socket based server base class.

Definition in file tcpserver.cc.

Macro Definition Documentation

◆ LISTEN_BACKLOG

#define LISTEN_BACKLOG   5

Definition at line 61 of file tcpserver.cc.

Function Documentation

◆ create_listener()

static int create_listener ( const std::string &  host,
int  port,
bool  tcp_nodelay 
)
static

Create a listening socket ready to accept connections.

Parameters
hosthostname or address to listen on or an empty string to accept connections on any interface.
portTCP port to listen on.
tcp_nodelayIf true, enable TCP_NODELAY option.

Definition at line 71 of file tcpserver.cc.

References CLOSESOCKET, EX_NOPERM, EX_UNAVAILABLE, LISTEN_BACKLOG, SOCK_CLOEXEC, and socket_errno().