libsocket
|
Internet-socket base class This class provides some fields for all internet sockets, like remote host and port and the used protocol version. More...
#include <inetbase.hpp>
Public Member Functions | |
const string & | gethost (void) const |
const string & | getport (void) const |
virtual int | destroy (void) |
Destroys a socket. More... | |
int | getfd (void) const |
Returns the socket file descriptor. More... | |
int | set_sock_opt (int level, int optname, const char *optval, socklen_t optlen) const |
Set socket options on the underlying socket. More... | |
void | set_close_on_destructor (bool cod) |
Protected Attributes | |
string | host |
The address we're bound or connected to. More... | |
string | port |
The port we're bound or connected to. More... | |
int | proto |
Which internet protocol version we're using. More... | |
int | sfd |
sfd is the sockets API file descriptor More... | |
bool | is_nonblocking |
bool | close_on_destructor |
Internet-socket base class This class provides some fields for all internet sockets, like remote host and port and the used protocol version.
Definition at line 52 of file inetbase.hpp.
const string & libsocket::inet_socket::gethost | ( | void | ) | const |
For sockets behaving as client: Returns the remote host. For sockets behaving as server: Returns the address bound to.
Definition at line 59 of file inetbase.cpp.
const string & libsocket::inet_socket::getport | ( | void | ) | const |
For sockets behaving as client: Returns the remote port. For sockets behaving as server: Returns the port bound to.
Definition at line 65 of file inetbase.cpp.
|
virtualinherited |
Destroys a socket.
0 | Fine! |
<0 | Most likely the socket was already closed before. |
Definition at line 72 of file socket.cpp.
|
inherited |
Returns the socket file descriptor.
getfd() is a getter you may use to obtain the file descriptor for raw operations on it. It's relatively uncritical as libsocket just wraps other syscalls and doesn't manipulate it using unusual ways.
Definition at line 91 of file socket.cpp.
|
inherited |
Set socket options on the underlying socket.
Sets socket options using setsockopt(2). See setsockopt(2), tcp(7), udp(7), unix(7) for documentation on how to use this function.
Definition at line 101 of file socket.cpp.
|
inlineinherited |
close_on_destructor
is true by default. If set to false, do not call close(2)
on the underlying socket in the destructor.
Definition at line 95 of file socket.hpp.
|
protected |
The address we're bound or connected to.
Definition at line 55 of file inetbase.hpp.
|
protected |
The port we're bound or connected to.
Definition at line 57 of file inetbase.hpp.
|
protected |
Which internet protocol version we're using.
Definition at line 59 of file inetbase.hpp.
|
protectedinherited |
sfd is the sockets API file descriptor
Definition at line 74 of file socket.hpp.
|
protectedinherited |
Default is true; if set to false, the file descriptor is not closed when the destructor is called.
Definition at line 78 of file socket.hpp.