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

Method setup

C++/unixclientdgram.cpp:58–75  ·  view source on GitHub ↗

* @brief Set a UNIX domain datagram socket up * * @param path The path to bind this socket to * @param flags Flags for `socket(2)` */

Source from the content-addressed store, hash-verified

56 * @param flags Flags for `socket(2)`
57 */
58void unix_dgram_client::setup(const char* path, int flags) {
59 if (sfd != -1)
60 throw socket_exception(__FILE__, __LINE__,
61 "unix_dgram_client::unix_dgram_client: Socket "
62 "has already been set up!",
63 false);
64
65 sfd = create_unix_dgram_socket(path, flags);
66
67 if (sfd < 0)
68 throw socket_exception(__FILE__, __LINE__,
69 "unix_dgram_client::unix_dgram_client: Could "
70 "not create unix dgram client socket!");
71
72 if (path) _path.assign(path);
73
74 is_nonblocking = flags & SOCK_NONBLOCK;
75}
76
77/**
78 * @brief Constructor with only `socket()` flags

Callers

nothing calls this directly

Calls 2

socket_exceptionClass · 0.85
create_unix_dgram_socketFunction · 0.85

Tested by

no test coverage detected