* @brief Connect socket * * Connects a client stream socket. * * @param path The server socket's path * @param socket_flags Flags for `socket(2)` (Do I repeat myself?) */
| 87 | * @param socket_flags Flags for `socket(2)` (Do I repeat myself?) |
| 88 | */ |
| 89 | void unix_stream_client::connect(const char* path, int socket_flags) { |
| 90 | if (sfd != -1) |
| 91 | throw socket_exception( |
| 92 | __FILE__, __LINE__, |
| 93 | "unix_stream_client::connect: Already connected!", false); |
| 94 | |
| 95 | sfd = create_unix_stream_socket(path, socket_flags); |
| 96 | |
| 97 | _path.assign(path); |
| 98 | |
| 99 | if (sfd < 0) |
| 100 | throw socket_exception(__FILE__, __LINE__, |
| 101 | "unix_stream_client::unix_stream_client: Could " |
| 102 | "not create and connect UNIX socket!"); |
| 103 | |
| 104 | // New file descriptor, therefore reset shutdown flags |
| 105 | shut_rd = false; |
| 106 | shut_wr = false; |
| 107 | } |
| 108 | |
| 109 | /** |
| 110 | * @brief Connect socket |
nothing calls this directly
no test coverage detected