9 #ifndef __libutilxx__sella__net__TCPSocket_H__
10 #define __libutilxx__sella__net__TCPSocket_H__
12 #include "../../common.h"
14 #include "IPAddressPort.h"
16 #include <sys/socket.h>
19 #define TCPSOCKET_LISTEN_BACKLOG_DEF SOMAXCONN
29 typedef std::shared_ptr<TCPSocket> shared;
33 TCPSocket(
int family)
throw (SocketException);
36 TCPSocket(
int family,
const std::string &address,
unsigned short port)
throw (SocketException);
41 void operator=(
const TCPSocket &sock) =
delete;
43 virtual void listen(
int backlog = TCPSOCKET_LISTEN_BACKLOG_DEF)
throw (SocketException);
44 virtual TCPSocket::shared accept(
void)
throw (SocketException);
46 static const TCPSocket::shared shared_ptr(
int family)
throw (SocketException);
47 static const TCPSocket::shared shared_ptr(
int family,
const IPAddressPort &addressport)
throw (SocketException);
48 static const TCPSocket::shared shared_ptr(
int family,
const IPAddress &address,
const Port &port)
throw (SocketException);
49 static const TCPSocket::shared shared_ptr(
int family,
const std::string &address,
unsigned short port)
throw (SocketException);
50 static const TCPSocket::shared shared_ptr(
const IPAddressPort &addressport)
throw (SocketException);
51 static const TCPSocket::shared shared_ptr(
const IPAddress &address,
const Port &port)
throw (SocketException);
54 TCPSocket(
int family,
int type,
int protocol)
throw (SocketException);
55 TCPSocket(
int s,
bool unused __attribute__((unused)))
throw (SocketException);