21 #ifndef G_LOCAL_SOCKET__H
22 #define G_LOCAL_SOCKET__H
29 #include <sys/socket.h>
34 class LocalSocketAddress ;
50 struct sockaddr *
p() ;
53 const struct sockaddr *
p()
const ;
62 struct sockaddr_un specific ;
63 struct sockaddr general ;
76 G_EXCEPTION( Error ,
"local socket error" ) ;
84 bool connect(
const std::string & address_path ,
bool no_throw =
false ) ;
88 void bind(
const std::string & address_path ) ;
LocalSocketAddress(const std::string &path)
Constructor.
An empty structure that is used to indicate a signal-safe, reentrant implementation.
int fd() const
Returns the socket's file descriptor.
void nonblock()
Makes the socket non-blocking.
LocalSocket(bool datagram)
Constructor for a datagram socket or a stream socket.
bool connect(const std::string &address_path, bool no_throw=false)
Connects to the given address.
~LocalSocket()
Destructor.
struct sockaddr * p()
Returns the sockaddr pointer.
bool connected() const
Returns true if the socket has been successfully connect()ed.
and accept()ing should be performed directly on the file descriptor.
An address class for G::LocalSocket that works with file system paths.
size_t size() const
Returns the sockaddr size.
void bind(const std::string &address_path)
Binds the given address to the socket. Throws Error on error.