MCPcopy Create free account
hub / github.com/dermesser/libsocket / setup

Method setup

C++/unixserverdgram.cpp:89–105  ·  view source on GitHub ↗

* @brief Binds a socket * * Binds a socket. (Also calls `listen()`) * * @param bindpath Bind path. * @param socket_flags Flags for `socket(2)` */

Source from the content-addressed store, hash-verified

87 * @param socket_flags Flags for `socket(2)`
88 */
89void 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

Callers

nothing calls this directly

Calls 2

socket_exceptionClass · 0.85

Tested by

no test coverage detected