* @brief Binds a socket * * Binds a socket. (Also calls `listen()`) * * @param bindpath Bind path. * @param socket_flags Flags for `socket(2)` */
| 87 | * @param socket_flags Flags for `socket(2)` |
| 88 | */ |
| 89 | void unix_dgram_server::setup(const char* bindpath, int socket_flags) { |
| 90 | if (sfd != -1) |
| 91 | throw socket_exception(__FILE__, __LINE__, |
| 92 | "unix_dgram_server::setup: Already set up!", |
| 93 | false); |
| 94 | |
| 95 | sfd = create_unix_server_socket(bindpath, LIBSOCKET_DGRAM, socket_flags); |
| 96 | |
| 97 | if (sfd < 0) |
| 98 | throw socket_exception( |
| 99 | __FILE__, __LINE__, |
| 100 | "unix_dgram_server::setup: Could not create server!"); |
| 101 | |
| 102 | _path.assign(bindpath); |
| 103 | bound = true; |
| 104 | is_nonblocking = socket_flags & SOCK_NONBLOCK; |
| 105 | } |
| 106 | |
| 107 | /** |
| 108 | * @brief Binds a socket |
nothing calls this directly
no test coverage detected