lib45d
45Drives C++ Library Development Documentation
|
23 #include <45d/socket/SocketBase.hpp>
69 int connection_fd = accept(
fd_, NULL, NULL);
70 if (connection_fd == -1) {
int io_fd_
Connection fd.
Definition: SocketBase.hpp:278
Unix Socket Server class. Used for IPC through a named socket inode.
Definition: UnixSocketServer.hpp:35
Thrown when bind() fails.
Definition: Exceptions.hpp:66
const std::string socket_path_
Path to socket inode, equal to address.
Definition: UnixSocketServer.hpp:80
Definition: Exceptions.hpp:71
std::vector< int > connections_
vector of open connections for closing in dtor
Definition: UnixSocketServer.hpp:82
const int _backlog_default
Number of connections to queue.
Definition: SocketBase.hpp:39
void bind(void)
Set up socket address structs and bind to the address inode path.
Definition: UnixSocketServer.hpp:87
Thrown when the socket address is too long.
Definition: Exceptions.hpp:57
45Drives namespace
Definition: Bytes.hpp:27
~UnixSocketServer()
Destroy the Unix Socket Server object.
Definition: UnixSocketServer.hpp:56
const int domain_
Socket domain, always AF_UNIX.
Definition: UnixSocketServer.hpp:79
struct sockaddr_un sock_addr_
Unix socket address structs.
Definition: UnixSocketServer.hpp:81
Base Unix Socket Class for opening and closing the socket.
Definition: SocketBase.hpp:57
int fd_
File descriptor of socket.
Definition: SocketBase.hpp:277
void listen(int backlog)
Start listening for connections.
Definition: UnixSocketServer.hpp:104
UnixSocketServer(const std::string &path, int backlog=Socket::_backlog_default)
Construct a new Unix Socket Server object.
Definition: UnixSocketServer.hpp:43
int wait_for_connection()
Uses accept() to block and wait for a connection, returning a file descriptor to the connection....
Definition: UnixSocketServer.hpp:68
Thrown when accept() fails.
Definition: Exceptions.hpp:80