Adbase
Adinf C++ base library V2
adbase::Socket Class Reference

#include <Socket.hpp>

Public Member Functions

 Socket (int sockfd, bool isFreeClose=true)
 
 ~Socket ()
 
int fd () const
 
bool getTcpInfo (struct tcp_info *) const
 
bool getTcpInfoString (char *buf, int len) const
 
void bindAddress (const InetAddress &localaddr)
 abort if address in use More...
 
void listen ()
 abort if address in use More...
 
int accept (InetAddress *peeraddr)
 
void shutdownWrite ()
 
void setTcpNoDelay (bool on)
 Enable/disable TCP_NODELAY (disable/enable Nagle's algorithm). More...
 
void setReuseAddr (bool on)
 Enable/disable SO_REUSEADDR. More...
 
void setReusePort (bool on)
 Enable/disable SO_REUSEPORT. More...
 
void setKeepAlive (bool on)
 Enable/disable SO_KEEPALIVE. More...
 

Detailed Description

Definition at line 17 of file Socket.hpp.

Constructor & Destructor Documentation

adbase::Socket::Socket ( int  sockfd,
bool  isFreeClose = true 
)
inlineexplicit

Definition at line 19 of file Socket.hpp.

References ~Socket().

adbase::Socket::~Socket ( )

Definition at line 13 of file Socket.cpp.

References adbase::sockets::close(), and LOG_DEBUG.

Referenced by Socket().

Member Function Documentation

int adbase::Socket::accept ( InetAddress peeraddr)
void adbase::Socket::bindAddress ( const InetAddress localaddr)

abort if address in use

Definition at line 79 of file Socket.cpp.

References adbase::sockets::bindOrDie(), and adbase::InetAddress::getSockAddrInet().

Referenced by adbase::Acceptor::Acceptor(), and fd().

bool adbase::Socket::getTcpInfo ( struct tcp_info *  tcpi) const

Definition at line 23 of file Socket.cpp.

Referenced by fd(), adbase::TcpConnection::getTcpInfo(), and getTcpInfoString().

bool adbase::Socket::getTcpInfoString ( char *  buf,
int  len 
) const

Definition at line 32 of file Socket.cpp.

References getTcpInfo().

Referenced by fd(), and adbase::TcpConnection::getTcpInfoString().

void adbase::Socket::listen ( )

abort if address in use

Definition at line 86 of file Socket.cpp.

References adbase::sockets::listenOrDie().

Referenced by adbase::Acceptor::Acceptor(), and fd().

void adbase::Socket::setKeepAlive ( bool  on)

Enable/disable SO_KEEPALIVE.

Definition at line 149 of file Socket.cpp.

Referenced by fd(), and adbase::TcpConnection::TcpConnection().

void adbase::Socket::setReuseAddr ( bool  on)

Enable/disable SO_REUSEADDR.

Definition at line 122 of file Socket.cpp.

Referenced by adbase::Acceptor::Acceptor(), and fd().

void adbase::Socket::setReusePort ( bool  on)

Enable/disable SO_REUSEPORT.

Definition at line 131 of file Socket.cpp.

References LOG_ERROR, and LOG_SYSERR.

Referenced by adbase::Acceptor::Acceptor(), and fd().

void adbase::Socket::setTcpNoDelay ( bool  on)

Enable/disable TCP_NODELAY (disable/enable Nagle's algorithm).

Definition at line 113 of file Socket.cpp.

Referenced by fd(), and adbase::TcpConnection::setTcpNoDelay().

void adbase::Socket::shutdownWrite ( )

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