FBB::SocketBase(3bobcat)

πŸ’– FBB::SocketBase β€” the bobcat manual page, bestie edition πŸ’–

okay so welcome to FBB::SocketBase(3bobcat), like the manual page name is literally SocketBase(3bobcat) and it lives in the bobcat manual, and the vibe is: this is the Base class for sockets 🧦 (fr fr, that's the whole energy β€” it's the base class for socket-constructing classes).


✨ NAME ✨

FBB::SocketBase β€” bestie, it's the Base class for socket-constructing classes 🫢


🌸 SYNOPSIS 🌸

#include <bobcat/socketbase>
Linking option: -lbobcat

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so here's the tea β˜•: this class is a base class for the FBB::ServerSocket and FBB::ClientSocket classes. And because it's designed as a base class β€” like, that's its whole identity, its main character energy β€” all its constructors are protected. Not public. Protected. Respect the boundaries bestie πŸ’…


πŸ‘‘ NAMESPACE πŸ‘‘

FBB

every constructor, member, operator and manipulator mentioned in this man-page is defined in the namespace FBB. all of them. no stragglers. periodt ✨


🌈 INHERITS FROM 🌈

FBB::InetAddress


πŸŽ€ PROTECTED CONSTRUCTORS πŸŽ€

  • SocketBase(size_t port) β€” this constructor creates a SocketBase to be used with ServerSocket-objects, listening on port. πŸ‘‚
  • SocketBase(std::string const &host, uint16_t port) β€” this constructor creates a FBB::SocketBase to be used with a ClientSocket-object, connecting to hostname, at port port. πŸ›°οΈ
heads up! these constructors throw a std::exception if they could not properly complete. so like, if something's off, she's gonna yell. 😭

The copy constructor and copy assignment operator are available. Both offer protected access rights. πŸ”


πŸ’œ PROTECTED MEMBER πŸ’œ

  • SocketBase makeBase(int socket, sockaddr_in const &address) β€” this member returns a FBB::SocketBase object initializing its socket and FBB::InetAddress from the provided arguments. it's giving "build me from these ingredients" 🧁

πŸ“ MEMBER FUNCTIONS πŸ“

All members of FBB::InetAddress are available, as FBB::SocketBase inherits from this class. (inheritance slay πŸ‘‘)

  • bool debug() const β€” this accessor returns true if the socket's debug (SO_DEBUG) socket option is active. It throws an FBB::Exception exception if the status of the debug option could not be determined;
  • bool reuse() const β€” this accessor returns true if the socket's reuse (SO_REUSEADDR) socket option is active. It throws an FBB::Exception exception if the status of the reuse option could not be determined;
  • void setDebug(bool trueIsOn) const β€” this member may be used to modify the socket's debug (SO_DEBUG) socket option. It throws an FBB::Exception exception if the socket's debug option could not be modified;
  • void setReuse(bool trueIsOn) const β€” this member may be used to modify the socket's reuse (SO_REUSEADDR) socket option. It throws an FBB::Exception exception if the socket's reuse option could not be modified;
  • int socket() const β€” this accessor returns the FBB::SocketBase's socket value. πŸ”Œ

🧚 EXAMPLE 🧚

The classes FBB::ClientSocket and FBB::ServerSocket were derived from SocketBase. E.g.,

#ifndef INCLUDED_BOBCAT_CLIENTSOCKET_
#define INCLUDED_BOBCAT_CLIENTSOCKET_

#include <string>
#include <bobcat/socketbase>
#include <bobcat/exception>

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

See the clientsocket(3bobcat) man-page for an example showing how to use FBB::ClientSocket. (go read it, it's good i promise 🫢)


⭐ FILES ⭐

bobcat/socketbase β€” defines the class interface


πŸ”₯ SEE ALSO πŸ”₯

bobcat(7), clientsocket(3bobcat), inetaddress(3bobcat), localsocketbase(3bobcat), serversocket(3bobcat)


πŸ’€ BUGS πŸ’€

None Reported. (not a single one. flawless. we love to see it ✨)


🌟 BOBCAT PROJECT FILES 🌟

Debian Bobcat project files:

  • libbobcat6: debian package containing the shared library, changelog and copyright note;
  • libbobcat-dev: debian package containing the static library, headers, manual pages, and developer info;

🩷 BOBCAT 🩷

Bobcat is an acronym of Brokken’s Own Base Classes And Templates. (iykyk 😌)


This is free software, distributed under the terms of the GNU General Public License (GPL). 🫢


πŸ’Œ AUTHOR πŸ’Œ

Frank B. Brokken (f.b.brokken@rug.nl).


okay bestie that's the whole page, no cap πŸ’– this was libbobcat-dev_6.15.01 dated 2005-2026 β€” shoutout to the bobcat era, she's been iconic since 2005 and she's still going, ate and left no crumbs, mwah πŸ’…βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from