Adbase
Adinf C++ base library V2
|
#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... | |
Definition at line 17 of file Socket.hpp.
|
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().
int adbase::Socket::accept | ( | InetAddress * | peeraddr | ) |
Definition at line 93 of file Socket.cpp.
References adbase::sockets::accept(), and adbase::InetAddress::setSockAddrInet().
Referenced by adbase::Acceptor::acceptHandler(), and fd().
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().
|
inline |
Definition at line 26 of file Socket.hpp.
References accept(), bindAddress(), getTcpInfo(), getTcpInfoString(), listen(), setKeepAlive(), setReuseAddr(), setReusePort(), setTcpNoDelay(), and shutdownWrite().
Referenced by adbase::Acceptor::acceptHandler(), adbase::Acceptor::init(), and adbase::TcpConnection::TcpConnection().
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 | ( | ) |
Definition at line 106 of file Socket.cpp.
References adbase::sockets::shutdownWrite().
Referenced by fd(), adbase::TcpConnection::shutdown(), and adbase::TcpConnection::writeCallback().