24 #include <netcomm/socket/stream.h> 26 #include <sys/types.h> 27 #include <sys/socket.h> 28 #include <netinet/in.h> 29 #include <netinet/tcp.h> 92 throw Exception(
"Socket not initialized, call bind() or connect()");
96 socklen_t val_len =
sizeof(val);
97 if ( getsockopt(
sock_fd, IPPROTO_TCP, TCP_NODELAY, &val, &val_len) == -1 ) {
98 throw SocketException(
"StreamSocket::nodelay: getsockopt failed", errno);
112 throw Exception(
"Socket not initialized, call bind() or connect()");
115 int val = (nodelay ? 1 : 0);
116 socklen_t val_len =
sizeof(val);
117 if ( setsockopt(
sock_fd, IPPROTO_TCP, TCP_NODELAY, &val, val_len) == -1 ) {
118 throw SocketException(
"StreamSocket::set_nodelay: setsockopt failed", errno);
StreamSocket(float timeout=0.f)
Constructor.
Fawkes library namespace.
AddrType
Address type specification.
TCP stream socket over IP.
virtual Socket * clone()
Clone socket.
Base class for exceptions in Fawkes.
bool nodelay()
Check if Nalge algorithm is disabled.
AddrType addr_type
Address type/family of socket.
int sock_fd
Socket file descriptor.
float timeout
Timeout in seconds for various operations.
void set_nodelay(bool no_delay)
Enable or disable Nagle algorithm.