strncpy(sun.sun_path, path.CStr(), sizeof(sun.sun_path));
sun.sun_path[sizeof(sun.sun_path) - 1] = '\0';
- if (bind(GetFD(), (sockaddr *)&sun, SUN_LEN(sun)) < 0)
- throw_exception(PosixException("bind() failed", errno);
+ if (bind(GetFD(), (sockaddr *)&sun, SUN_LEN(&sun)) < 0)
+ throw_exception(PosixException("bind() failed", errno));
}
void UnixSocket::Connect(const String& path)
strncpy(sun.sun_path, path.CStr(), sizeof(sun.sun_path));
sun.sun_path[sizeof(sun.sun_path) - 1] = '\0';
- if (connect(GetFD(), (sockaddr *)&sun, SUN_LEN(sun)) < 0 && errno != EINPROGRESS)
- throw_exception(PosixException("connect() failed", errno);
+ if (connect(GetFD(), (sockaddr *)&sun, SUN_LEN(&sun)) < 0 && errno != EINPROGRESS)
+ throw_exception(PosixException("connect() failed", errno));
}
-#endif /* _WIN32 */
\ No newline at end of file
+#endif /* _WIN32 */
typedef shared_ptr<UnixSocket> Ptr;
typedef weak_ptr<UnixSocket> WeakPtr;
+ UnixSocket(void);
+
void Bind(const String& path);
void Connect(const String& path);
}
#endif /* _WIN32 */
-#endif /* UNIXSOCKET_H */
\ No newline at end of file
+#endif /* UNIXSOCKET_H */