FBB::Lo...tSocket(3bobcat)
π FBB::LocalClientSocket β the Unix Domain client socket, bestie edition π
okay so this is a page from bobcat, section 3bobcat β that's the manual name, consider it folded into your hair like a lil flower π β all about FBB::LocalClientSocket. It's the client half of a Unix Domain socket convo. Let's get into it, no cap.
πΈ NAME πΈ
FBB::LocalClientSocket β a Client Socket that connects to a Server over in the Unix Domain. it's giving "i make the call, you pick up" π
β¨ SYNOPSIS β¨
#include <bobcat/localclientsocket>
Linking option: -lbobcat
that's it, that's the whole vibe. π
π¦ DESCRIPTION π¦
So. You can construct an FBB::LocalClientSocket to connect to a server process in the Unix Domain. The socket that the FBB:LocalClientSocket hands you can be used to initialize a std::istream and/or a std::ostream. The std::istream is what you use to read info coming from the server process that your FBB::LocalClientSocket is connected to, and the std::ostream is what you use to send info to that server process. π
And because a socket can be thought of as a file descriptor, the classes FBB::IFdStream, FBB::IFdStreamBuf, FBB::OFdStream, and FBB::OFdStreamBuf are all right there and may be used profitably here. girl, use them. π«Ά
β οΈ but real talk β just having a socket does not mean the communication protocol is defined. That's still on the programmer: comply with an existing protocol, or implement a tailor-made one. And that latter situation implies the sequence of input- and output operations is defined by the programmer. yes. YOU. you're the protocol architect now, main character energy. π
π NAMESPACE π
FBB
All constructors, members, operators and manipulators mentioned in this man-page are defined in the namespace FBB. periodt.
π§ INHERITS FROM π§
FBB::LocalSocketBase
it literally inherited the whole aesthetic from its parent. slay.
π CONSTRUCTOR π
LocalClientSocket()β this constructor merely creates aFBB::LocalClientSocketobject. Before it can be used, itsopen()member must be called. so like, it exists, but it's not ready ready, yk? πLocalClientSocket(std::string const &name)β this constructor initializes anFBB::LocalClientSocketobject, using the named Unix Domain socket to connect to the server using the named Unix Domain socket. AnFBB::Exceptionis thrown if the socket could not be constructed. And heads up bestie: the construction of the socket does not mean that a connection has actually been established. In order to connect to the server, the memberconnect()(see below) should be used. it's constructed, not connected β two different things, iykyk π
Copy and move constructors (and assignment operators) are not available. nope. not invited to the party. π
π MEMBER FUNCTION π
int connect()β this member returns a socket that can be used to communicate with the server process. AnFBB::Exceptionexception is thrown if the connection could not be established. this is the moment. the β¨connectionβ¨. π₯open(std::string const &name)β this member function prepares theFBB::LocalClientSocketobject, constructed earlier using the default constructor, for use. The named Unix Domain socket is used to connect to the server using the named Unix Domain socket. AnFBB::Exceptionis thrown if the socket could not be constructed. The construction of the socket does not mean that a connection has actually been established. In order to connect to the server, the memberconnect()should be used. same energy as the string constructor honestly, it's just the glow-up path for a default-constructed object. πΈ
β EXAMPLE β
See also the localserversocket(3bobcat) example.
#include <iostream>
#include <bobcat/localclientsocket>
#include <bobcat/ifdstream>
#include <bobcat/ofdstream>
using namespace std;
using namespace FBB;
int main(int argc, char **argv)
try
{
if (argc == 1)
{
cerr << "Provide filename representing the unix domain socket\n";
return 1;
}
LocalClientSocket client(argv[1]);
int fd = client.connect();
string line;
cout << "Connecting to socket " << fd << endl;
IFdStream in(fd); // stream to read from
OFdStream out(fd); // stream to write to
while (true)
{
// Ask for a textline, stop if empty / none
cout << "? ";
if (!getline(cin, line) || line.length() == 0)
return 0;
cout << "Line read: " << line << endl;
// Return the line to the server
out << line.c_str() << endl;
cout << "wrote line\n";
// Wait for a reply from the server
getline(in, line);
cout << "Answer: " << line << endl;
}
}
catch (Exception const &err)
{
cerr << err.what() << "\n" <<
"Canβt connect to " << argv[1] << ", port " << argv[2] << endl;
return 1;
}
look at that little loop go β ask, send, wait, answer, repeat. iconic behaviour fr fr. π
π FILES π
bobcat/localclientsocket β defines the class interface
π SEE ALSO π
bobcat(7), ifdstream(3bobcat), ifdbuf(3bobcat), clientsocket(3bobcat), localserversocket(3bobcat), localsocketbase(3bobcat), ofdstream(3bobcat), ofdstream(3bobcat)
(yes, ofdstream(3bobcat) is listed twice in the original β we do not edit the sacred texts, we just love it twice π)
π BUGS π
None Reported.
not a single one. we're clean. we're thriving. β¨
πΈ BOBCAT PROJECT FILES πΈ
- https://fbb-git.gitlab.io/bobcat/ β gitlab project page;
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. cute AND functional, we love an acronym that serves. π«Ά
π COPYRIGHT π
This is free software, distributed under the terms of the GNU General Public License (GPL).
free as in freedom, bestie. π¦
π AUTHOR π
Frank B. Brokken (f.b.brokken@rug.nl).
and that's the whole page!! tysm for reading, mwah π β this was libbobcat-dev_6.15.01, dated 2005-2026, and yes the page title really is styled FBB::Lo...tSocket(3bobcat) because the header got a lil βοΈ trimmed. go forth and connect to your server, you've got this. πβ¨
π¦ where this page comes from
- ubuntu stonking: libbobcat-dev 6.15.01-1 Β· GPL-3.0-or-later WITH OpenSSL exception
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms