24 #include <netcomm/socket/stream.h>
25 #include <netinet/in.h>
26 #include <netinet/tcp.h>
27 #include <sys/socket.h>
28 #include <sys/types.h>
97 throw Exception(
"Socket not initialized, call bind() or connect()");
101 socklen_t val_len =
sizeof(val);
102 if (getsockopt(
sock_fd, IPPROTO_TCP, TCP_NODELAY, &val, &val_len) == -1) {
103 throw SocketException(
"StreamSocket::nodelay: getsockopt failed", errno);
116 throw Exception(
"Socket not initialized, call bind() or connect()");
120 socklen_t val_len =
sizeof(val);
121 if (setsockopt(
sock_fd, IPPROTO_TCP, TCP_NODELAY, &val, val_len) == -1) {
122 throw SocketException(
"StreamSocket::set_nodelay: setsockopt failed", errno);
Base class for exceptions in Fawkes.
int sock_fd
Socket file descriptor.
AddrType
Address type specification.
Socket & operator=(Socket &socket)
Copy constructor.
TCP stream socket over IP.
StreamSocket(float timeout=0.f)
Constructor.
void set_nodelay(bool no_delay)
Enable or disable Nagle algorithm.
virtual Socket * clone()
Clone socket.
bool nodelay()
Check if Nalge algorithm is disabled.
StreamSocket & operator=(StreamSocket &s)
Assingment operator.
Fawkes library namespace.