Skip to content
Snippets Groups Projects

Draft: Resolve "Unix Socket Server schreiben"

Merged Leon Dietrich requested to merge 3-unix-socket-server-schreiben into master
1 file
+ 3
3
Compare changes
  • Side-by-side
  • Inline
@@ -11,14 +11,14 @@
namespace rmrf::net {
auto_fd construct_server_fd(const socketaddr& addr) {
if(addr.family() != AF_UNIX) {
if (addr.family() != AF_UNIX) {
throw netio_exception("Expected a UNIX socket file path.");
}
// man 7 unix suggests the ussage of SOCK_SEQPACKET, but we'd loose the ability to distinguish multiple clients if we do so
auto_fd socket_fd{socket(addr.family(), SOCK_STREAM, 0)};
if(!socket_fd.valid()) {
if (!socket_fd.valid()) {
throw netio_exception("Failed to create UNIX socket. Do you have the permissions to do this?");
}
@@ -47,7 +47,7 @@ unix_socket_server::~unix_socket_server() {}
std::shared_ptr<connection_client> unix_socket_server::await_raw_socket_incomming(const auto_fd& server_socket) {
auto client_socket = auto_fd{accept(server_socket.get(), nullptr, nullptr)};
if(!client_socket.valid()) {
if (!client_socket.valid()) {
throw netio_exception("Failed to accept incomming client to unix socket.");
}
Loading