.TH "FBB::SocketBase" "3bobcat" "2005\-2023" "libbobcat\-dev_6\&.04\&.00" "Base class for sockets" .PP .SH "NAME" FBB::SocketBase \- Base class for socket\-constructing classes .PP .SH "SYNOPSIS" \fB#include \fP .br Linking option: \fI\-lbobcat\fP .PP .SH "DESCRIPTION" This class is a base class for the \fBFBB::ServerSocket\fP and \fBFBB::ClientSocket\fP classes\&. Since it is designed as a base class, all its constructors are protected\&. .PP .SH "NAMESPACE" \fBFBB\fP .br All constructors, members, operators and manipulators, mentioned in this man\-page, are defined in the namespace \fBFBB\fP\&. .PP .SH "INHERITS FROM" \fBFBB::InetAddress\fP .PP .SH "PROTECTED CONSTRUCTORS" .IP o \fBSocketBase(size_t port)\fP: .br This constructor creates a \fBSocketBase\fP to be used with \fBServerSocket\fP\-objects, listening on \fIport\fP\&. .IP .IP o \fBSocketBase(std::string const &host, uint16_t port)\fP: .br This constructor creates a \fBFBB::SocketBase\fP to be used with a \fBClientSocket\fP\-object, connecting to \fIhostname\fP, at port `\fIport\fP\(cq\&\&. .PP These constructors throw a \fIstd::exception\fP if they could not properly complete\&. .PP The copy constructor and copy assignment operator are available\&. Both offer protected access rights\&. .PP .SH "PROTECTED MEMBER" .IP o \fBSocketBase makeBase(int socket, sockaddr_in const &address)\fP: .br This member returns a \fBFBB::SocketBase\fP object initializing its socket and \fBFBB::InetAddress\fP from the provided arguments\&. .PP .SH "MEMBER FUNCTIONS" All members of \fBFBB::InetAddress\fP are available, as \fBFBB::SocketBase\fP inherits from this class\&. .PP .IP o \fBbool debug() const\fP: .br This accessor returns \fBtrue\fP if the socket\(cq\&s \fIdebug\fP (\fBSO_DEBUG\fP) socket option is active\&. It throws an \fBFBB::Exception\fP exception if the status of the debug option could not be determined; .IP .IP o \fBbool reuse() const\fP: .br This accessor returns \fBtrue\fP if the socket\(cq\&s \fIreuse\fP (\fBSO_REUSEADDR\fP) socket option is active\&. It throws an \fBFBB::Exception\fP exception if the status of the reuse option could not be determined; .IP .IP o \fBvoid setDebug(bool trueIsOn) const\fP: .br This member may be used to modify the socket\(cq\&s \fIdebug\fP (\fBSO_DEBUG\fP) socket option\&. It throws an \fBFBB::Exception\fP exception if the socket\(cq\&s debug option could not be modified; .IP .IP o \fBvoid setReuse(bool trueIsOn) const\fP: .br This member may be used to modify the socket\(cq\&s \fIreuse\fP (\fBSO_REUSEADDR\fP) socket option\&. It throws an \fBFBB::Exception\fP exception if the socket\(cq\&s reuse option could not be modified; .IP .IP o \fBint socket() const\fP: .br This accessor returns the \fBFBB::SocketBase\fP\(cq\&s socket value\&. .PP .SH "EXAMPLE" The classes \fIFBB::ClientSocket\fP and \fIFBB::ServerSocket\fP were derived from \fISocketBase\fP\&. E\&.g\&., .nf #ifndef INCLUDED_BOBCAT_CLIENTSOCKET_ #define INCLUDED_BOBCAT_CLIENTSOCKET_ #include #include #include namespace FBB { class ClientSocket: public SocketBase { public: // host may be address or name ClientSocket(std::string const &host, uint16_t port); int connect(); // returns fd (socket) to talk to the server }; } // FBB #endif .fi .PP See the \fBclientsocket\fP(3bobcat) man\-page for an example showing how to use \fIFBB::ClientSocket\fP\&. .PP .SH "FILES" \fIbobcat/socketbase\fP \- defines the class interface .PP .SH "SEE ALSO" \fBbobcat\fP(7), \fBclientsocket\fP(3bobcat), \fBinetaddress\fP(3bobcat), \fBlocalsocketbase\fP(3bobcat), \fBserversocket\fP(3bobcat) .PP .SH "BUGS" None Reported\&. .PP .SH "BOBCAT PROJECT FILES" .PP .IP o \fIhttps://fbb\-git\&.gitlab\&.io/bobcat/\fP: gitlab project page; .IP o \fIbobcat_6\&.04\&.00\-x\&.dsc\fP: detached signature; .IP o \fIbobcat_6\&.04\&.00\-x\&.tar\&.gz\fP: source archive; .IP o \fIbobcat_6\&.04\&.00\-x_i386\&.changes\fP: change log; .IP o \fIlibbobcat1_6\&.04\&.00\-x_*\&.deb\fP: debian package containing the libraries; .IP o \fIlibbobcat1\-dev_6\&.04\&.00\-x_*\&.deb\fP: debian package containing the libraries, headers and manual pages; .PP .SH "BOBCAT" Bobcat is an acronym of `Brokken\(cq\&s Own Base Classes And Templates\(cq\&\&. .PP .SH "COPYRIGHT" This is free software, distributed under the terms of the GNU General Public License (GPL)\&. .PP .SH "AUTHOR" Frank B\&. Brokken (\fBf\&.b\&.brokken@rug\&.nl\fP)\&. .PP