1 #ifndef LIBSOCKET_SOCKET_H_CCC0882809A540AAAD842D9AE3DB47BB 2 #define LIBSOCKET_SOCKET_H_CCC0882809A540AAAD842D9AE3DB47BB 4 #include <sys/socket.h> 42 #define LIBSOCKET_TCP 1 43 #define LIBSOCKET_UDP 2 45 #define LIBSOCKET_IPv4 3 46 #define LIBSOCKET_IPv6 4 48 #define LIBSOCKET_BOTH 5 // what fits best (TCP/UDP or IPv4/6) 50 #define LIBSOCKET_READ 1 51 #define LIBSOCKET_WRITE 2 53 #define LIBSOCKET_NUMERIC 1 89 int getfd(
void)
const;
91 int set_sock_opt(
int level,
int optname,
const char* optval,
92 socklen_t optlen)
const;
Contains libsocket elements.
int set_sock_opt(int level, int optname, const char *optval, socklen_t optlen) const
Set socket options on the underlying socket.
int getfd(void) const
Returns the socket file descriptor.
socket is the base class of every other libsocket++ object.
socket(void)
Constructor. Sets sfd to -1.
int sfd
sfd is the sockets API file descriptor
void set_close_on_destructor(bool cod)
virtual ~socket()
Destructor: closes socket.
virtual int destroy(void)
Destroys a socket.