| 21 | } |
| 22 | |
| 23 | void UnixSocket::Bind(const String& path) |
| 24 | { |
| 25 | unlink(path.CStr()); |
| 26 | |
| 27 | sockaddr_un s_un; |
| 28 | memset(&s_un, 0, sizeof(s_un)); |
| 29 | s_un.sun_family = AF_UNIX; |
| 30 | strncpy(s_un.sun_path, path.CStr(), sizeof(s_un.sun_path)); |
| 31 | s_un.sun_path[sizeof(s_un.sun_path) - 1] = '\0'; |
| 32 | |
| 33 | if (bind(GetFD(), (sockaddr *)&s_un, SUN_LEN(&s_un)) < 0) { |
| 34 | BOOST_THROW_EXCEPTION(posix_error() |
| 35 | << boost::errinfo_api_function("bind") |
| 36 | << boost::errinfo_errno(errno)); |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | void UnixSocket::Connect(const String& path) |
| 41 | { |
nothing calls this directly
no test coverage detected